Date(); Wrong Time Zone
Moderator: General Moderators
Date(); Wrong Time Zone
Im using Date("m/d/y"); and its off by a day right now its saying its the 10th when its really the 9th any way i can set it to PST?
mktime should help.
"-8" subtracts 8 hours from the current time, which makes it PST since there's an 8 hour time difference between PST and most of Europe.
Code: Select all
<?
echo date("m/d/y",mktime(date(H)-8));
?>ummm....
simple way: you know your utc offset, right?
since GMT is the basis of a UTC, create it as a UTC
for me that would be getting a print out from....
just adjust where the 5 is to your timezone.that prints out a UTC timestamp (UTC is the time with the gmt offset) i've also seen UTC used as being synonymous with zulu (forgets about daylight savings) and rarely as being gmt (which actually changes based on daylight savnigs)
simple way: you know your utc offset, right?
since GMT is the basis of a UTC, create it as a UTC
for me that would be getting a print out from....
Code: Select all
<?php
$time=gmmktime("m/d/y h:i:s", (time()+(60*60*-5)));
echo "$time -05:00:00";
?>i normally try to do that, but my dev environment is LAMP and i will find a hosting company with LAMP for mine because of the stability of linux.the thing i'm trying to do needs to be able to show members times relative to them. i store gmt_offset in hours. multiply that by 60*60 and use that to display times
-
onefocus99
- Forum Newbie
- Posts: 16
- Joined: Tue Oct 07, 2003 11:09 pm
- Location: Hamilton Ont., Montreal, Chibougamau,... PQ, Victoria BC, now Alberta Canada
Page Last update showing the proper time zone...
You see my server is 1 hour behind where I live
So if I want to show when my page was last updated:
$LastMod = filemtime("index.php"); //60*60=3600 or 1 hour
print(date("l F d, Y - g:i a", ($LastMod+3600) ));
which prints:
Friday December 26, 2003 - 12:31 am
You see my server is 1 hour behind where I live
So if I want to show when my page was last updated:
$LastMod = filemtime("index.php"); //60*60=3600 or 1 hour
print(date("l F d, Y - g:i a", ($LastMod+3600) ));
which prints:
Friday December 26, 2003 - 12:31 am