Page 1 of 1
date() function
Posted: Thu May 26, 2005 9:44 am
by ibolui
hi, i am having a problem with the date() as well as getdate().
the unix timestamp is 1117583940, which should be converted to 31 may 2005.
but i use both date() and getdate() and they give me 1 june 2005.
someone helps? thanks.
Posted: Thu May 26, 2005 9:50 am
by pickle
Yep, I'm getting "Tuesday, May 31st, 2005 - 5:59 pm" from that stamp. Can you show your code?
Posted: Thu May 26, 2005 10:03 am
by ibolui
hmm.. here's my code
$date = date("d F Y", $row['date']);
where $row['date'] is the timestamp
i am using php 5.0.4 in winxp...
Posted: Thu May 26, 2005 10:09 am
by pickle
Well, if when you echo $date and $row['date'] right after that, you get 1117583940 and 1 june 2005 respectively, I have no idea. Maybe try putting the time of day in $date as well to see exactly how much its off.
Posted: Thu May 26, 2005 10:30 am
by ibolui
i tried
Code: Select all
date("e;r"e;, $rowї'date'])
and get wed 01 jun 2005 07:59:00 +0800
Posted: Thu May 26, 2005 3:32 pm
by pickle
Could it be timezone problems? Like I said, I'm getting 5:59 PM, in MST which is -0700 right now. With the time difference, that would pop it ahead a day. I'm not really sure how to apply this info to solve your problem, but it's the only thing I can think of that might be doing it.
Is the time on your server right?
Posted: Fri May 27, 2005 12:08 am
by ibolui
my comp is set to +0800. actually i am trying to play around with phpbb. i installed phpbb and i set the board time in admincp to gmt.
i also tried changing my comp to gmt but no use. is there another time setting for the server? where is it and how do i change it?
thanks.
Posted: Fri May 27, 2005 10:00 am
by pickle
If you're running your own Linux server, look into the rdate shell command. That will sync your server's time with another server.
If you've set phpBB's time to GMT and you're not in that timezone, that might explain why the times are off. If you set it to where you actually are, the date might make more sense.
Posted: Fri May 27, 2005 10:41 am
by Sphen001
Hi,
The thing about phpBB's system is that you have to set the server time in the ACP, as well as your local time in the profile page.
Hope this helps
Sphen001