Direct Mysql Insert statement results with UTC_TIMESTAMP differs from same wappler API Insert statement

Hi Community,
I’m new to Wappler, not to programming, so far, love the ease of use with Wappler and how it has expedited my code implementation! Thank you Wappler Team!

Here is the discrepancy I’ve encountered when using specifically the UTC_TIMESTAMP function in an insert/update statement, when I run the following statement directly in MySQL I get the following result
INSERT INTO dummyTable (id, user_id, disposal_date) VALUES (1234, 1, UTC_TIMESTAMP) --> Disposal Date Result --> 2022-01-21 23:33:19

When I run the same Statement via the Wappler API I get a different result, which I believe the Wappler backend interprets the UTC_TIMESTAMP as a NOW() function, opposed to UTC function.
INSERT INTO dummyTable (id, user_id, disposal_date) VALUES (:P1 /* {{$_POST.id}} /, :P2 / {{identity}} /, :P3 / {{UTC_TIMESTAMP}} */)
Disposal Date Result --> 2022-01-21 18:33:36

My question is how can I write a consistent statement with the UTC_TIMESTAMP function in Wappler to expect the same results as I input into MySQL?

Thank you

I use UTC everywhere with no issues and I’m typically 1 or 2 hours adrift - on the front-end I always show local time - Wappler deals with all of that nicely, every time.

So, just checking as they’re 5 hours adrift, what’s your time-zone relative to UTC ?? And how are you querying for the ‘Disposal Date Result’ in both cases ?? And are you storing the data in a UTC field

Wappler does the UTC adjustments when recalling date fields on the front-end - so can you query the data via the MySQL query tool in both cases and verify they’re the same …

Might this also be impacted by where you are running your queries?
You don’t specify the targets on these tests. But it appears one request shows your own machine time and the other shows the machine time on a remote server.

A local MySQL query on your development machine will simply stamp the same time as your computer time.

A query to a remote server in another time zone would give you the time set on that server.
Do you know the server time on that remote host?

Correct, my TZ and local server is -5 from UTC, therefore wappler is converting the data correctly. However, the expected result from a UTC insert into the table should be UTC time, not the local time for the user or server location, which is what wappler is inserting. Then when displaying the data back to the user, the query should then manipulate the UTC to reflect local user time.

Have you checked the mySQL logs to see what’s actually being sent to the server in the call?

I’d start there. It’s simply a case of elimination at this stage

1 Like