Page 1 of 1

Want to get current Web Server Time then subtract 6 hours

Posted: Sat Dec 04, 2010 5:56 am
by Brook
Currently I think that I understand that you can get the time of the web server in php by calling the Now() function.

Because my web server is in a different time zone than I am in, I would like to subract 6 hours from the current web server time. Example when I login to the Admin I would like to see the time shown on my Admin website in my timezone time.

Example If the current webserver time is 12:00am, I would like to display on my PHP page that it is 6:00pm, since my time zone is 6 hours behind my web server time. Example, I have the User Login Module installed, which shows the users who are currently online and shows a column for Last Activity (showing the web server time of the user's last activity).

What code would I use to subract 6 hours from the current web server time n PHP?

Re: Want to get current Web Server Time then subract 6 hours

Posted: Sat Dec 04, 2010 7:27 am
by JAY6390
$unix_timestamp = strtotime('-6 hours');

That will give you the time in a unix timestamp format that you can use with the date function to create your timestamp