Page 1 of 1
Time Offset
Posted: Mon Mar 28, 2005 4:01 pm
by Bob Norris
Hello,
Can anyone please tell me how to offset the time in this code? I need it to be -6 hours from local time
Code: Select all
$msgcontent = "e;Local time : $tgl\n\nThe addition from $vname
Thank you so much!
Posted: Mon Mar 28, 2005 4:11 pm
by feyd
uh... where's $tgl from?
Same
Posted: Mon Mar 28, 2005 4:14 pm
by Bob Norris
THe $tgl is server time I think,, and its in the uk Sorry I hope thats what you ment
Posted: Mon Mar 28, 2005 4:22 pm
by feyd
kinda need to know what $tgl is and how it's set in order to tell you how to change it. Unless you want to create your own version, in which case:
Code: Select all
$tgl = gmdate('Y-m-d H:i:s', time() - (6 * 60 * 60));
Posted: Mon Mar 28, 2005 6:21 pm
by Pyrite
Unfortunately, the above doesn't take into account DST. Like if you do UTC+1 (Germany), right now it will say 1 am, but Germany is in CEST right now, and the time is 2 am . If the server resides in the timezone you wish to print the time for, you can know if DST is on by the output of date("I") though. But I don't think that is what you are wanting to do.
Same Topic
Posted: Mon Mar 28, 2005 9:05 pm
by Bob Norris
Thank you,
What I'm trying to do is,, my form when some one enters information it puts a time stamp on it, The server is in the UK and I am in the US (EST) I would like the form to show EST so I need to offset it -5 hours. Thanks in advance
Bob
Posted: Mon Mar 28, 2005 11:49 pm
by Pyrite
Right, that code will work, except by Sunday the 3rd of April I think, it should be -4, cause EST will be EDT for daylight time, one hour ahead.