This topic is locked

how to set system date/time for phprunner projects?

4/24/2025 10:18:23 PM
PHPRunner General questions
W
wfcentral author

I'm now using the notification feature in phprunner. I am adding notifications two different ways and the date/time is not matching.

If I use an external file to add a notification to the database table the date/time is correct for my timezone.

If I use the event code inside phprunner to add a notification to the database table the date/time is 4 hours ahead of my actual date/time. The notification dropdown will say that the notification came in "5 minutes ago" but if you check the actual created date/time in the table it is 4 hours in the future.

Because of this time difference it makes it look like messages I insert with external code are actually much older than they really are. While I could change my external code to be 4 hours later this seems like a bad idea because the created date/time in the database would still be 4 hours ahead of what the real time is.

HJB 4/25/2025

… for inspiration purposes only …, direct from the Xlinesoft horses’s mouth ...

Excerpt ex: https://asprunner.com/forums/topic/28357-date_default_timezone_set-Question
In PHP you can use one of two options to populate datetime fields. First option is to use now()
as a default value of the field. And a second - use code like this in BeforeAdd/BeforeEdit events:

$values["FieldNameHere"] = now();