DMXzone Server Connect Support Product Page
Solved
{{NOW}} global variable inserting UTC date & time
Reported 10 May 2017 12:51:19
1
has this problem
10 May 2017 12:51:19 David Woolley posted:
I have a date_created field in a table that I've setup in phpmyadmin as a TIMESTAMP without the ON_UPDATE attribute. I have used the {{NOW}} global variable in Server Connect to insert the date & time when the record is created. This works but is inserting the UTC date & time the same as the {{NOW_UTC}} global variable. I'm in UTC +2h What can I do to adjust the {{NOW}} to give the correct date & time?
I also have a date_updated field that updates the date & time when a record is edited.
This is changing the date & time correctly for UTC +2h.
Replies
Replied 10 May 2017 13:17:23
10 May 2017 13:17:23 David Woolley replied:
I've fixed this in the meantime by using the expression:
{{NOW.dateAdd("hours", 2)}}
using the server data formatter
If there is a problem with the {{NOW}} global variable, please let me know.
Dave
{{NOW.dateAdd("hours", 2)}}
using the server data formatter
If there is a problem with the {{NOW}} global variable, please let me know.
Dave
Replied 10 May 2017 13:32:53
10 May 2017 13:32:53 Teodor Kuduschiev replied:
Hello David,
In server connect {{NOW}} returns what the timezone setting of your server is set to. If it inserts UTC date/time, then in your server's settings the timezone is set to UTC.
In server connect {{NOW}} returns what the timezone setting of your server is set to. If it inserts UTC date/time, then in your server's settings the timezone is set to UTC.
Replied 10 May 2017 14:01:58
10 May 2017 14:01:58 David Woolley replied:
Thanks Teodor
What is confusing is that the on_update timestamp inserts the correct UTC+2 time.
Is that not dependent on the server time zone setting?
Dave
What is confusing is that the on_update timestamp inserts the correct UTC+2 time.
Is that not dependent on the server time zone setting?
Dave
Replied 10 May 2017 14:32:00
10 May 2017 14:32:00 Teodor Kuduschiev replied:
Probably your mysql server is using some other timezone settings. {{NOW}} uses web server's timezone settings. Just check it in your php.ini
Replied 10 May 2017 14:49:37
10 May 2017 14:49:37 David Woolley replied:
Correct - it was set to UTC in php.ini
Changed the timezone setting - now all is well.
Dave
Changed the timezone setting - now all is well.
Dave