This topic is locked
[SOLVED]

 Default time field value - time offset...

2/20/2011 6:07:53 PM
PHPRunner General questions
C
CodeDog author

Have done some searching in the forums and generic searches in Google, haven't found an answer.
I have a time field that I'm putting a default value in with the Now() function, that works great. Problem is that the server timezone is different than local time by two hours, and I'd like to offset the default time by that two hours. Is there a simple way to do this I haven't found, short of modifying the code? Seems like a time offset option should be available, but can't find anything.
Thanks...

Sergey Kornilov admin 2/21/2011

Probably the best approach is to change timezone in php.ini file on the server.
Another option is to add two hours to default value. Instead of now use the following:

date("Y-m-d H:i:s",strtotime("+2 hours"))
C
CodeDog author 2/21/2011



Probably the best approach is to change timezone in php.ini file on the server.
Another option is to add two hours to default value. Instead of now use the following:

date("Y-m-d H:i:s",strtotime("+2 hours"))



Thanks. I'd already tried doing it in php.ini and htaccess with no luck (GoDaddy servers). Not sure why that didn't work, but I went ahead and did it in PHP with:

date_default_timezone_set('America/Detroit');


and that seemed to work okay. I like your solution for the default value better and will use that from now on, appreciate it.
Edit: By the way, a time offset feature would be a great addition to the time field properties in PHPRunner...