Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-20-2007, 11:16 PM I got the wrong date
Super Talker

Posts: 116
Name: Paul
Location: South Africa
Trades: 0
I have a section of my site that has a date displayed however when I made it 6 months ago or so, it would always display correct information, now it is wrong by 1 hour I have read that it is because of daylight saings time but my country does not observe daylight savings and the machine time is still correct. here is the code I used to call the date echo date ("F j, Y, g:i a"); does anyone know how I can fix this it is an hour ahead at the moment.
scorpioserve is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-20-2007, 11:20 PM Re: I got the wrong date
coolkbk585's Avatar
Be good this Christmas!

Latest Blog Post:
KBlog has been deativated
Posts: 642
Name: Kyle
Location: Ada, MI
Trades: 0
It's the time of the server, so if the server runs daylight savings time, it will show up on the site.
coolkbk585 is offline
Reply With Quote
View Public Profile Visit coolkbk585's homepage!
 
Old 08-20-2007, 11:38 PM Re: I got the wrong date
Super Talker

Posts: 116
Name: Paul
Location: South Africa
Trades: 0
Do you know how I could turn this off, and I assume by server you mean the apache server not the actual operating system cause that seems correct.
scorpioserve is offline
Reply With Quote
View Public Profile
 
Old 08-21-2007, 01:15 AM Re: I got the wrong date
Novice Talker

Posts: 9
Name: Svetoslav Marinov
Trades: 0
you may try something like that:

Code:
<?php
putenv('TZ=America/New_York');
echo date("Y-m-d h:i:sa", time());
?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
lordspace is offline
Reply With Quote
View Public Profile Visit lordspace's homepage!
 
Old 08-21-2007, 10:59 AM Re: I got the wrong date
Super Talker

Posts: 116
Name: Paul
Location: South Africa
Trades: 0
Quote:
Originally Posted by lordspace View Post
you may try something like that:

Code:
<?php
putenv('TZ=America/New_York');
echo date("Y-m-d h:i:sa", time());
?>
Thanks so much it worked perfectly, great problem finally fixed, now I hope I have not made a mistake cause after your first port I went into my php.ini file and set the timezome and uncommented the line, then i downloaded a timezone.db file off a site and loaded it into the extensions folder in the php folder. do you think i should change this back, cause it is working fine now that your code is in.
scorpioserve is offline
Reply With Quote
View Public Profile
 
Old 08-21-2007, 12:59 PM Re: I got the wrong date
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
No, no need to change again.

The only thing you made was to specify to the php engine in which time zone the server is located.
On unix server, the time stored inside the bios should always be the GMT time, and the os handle the time shift via the timeZone setting.

Probably, the server had another timezone specified, off by 1 hour, and forcing it in php corrected it.
Now, don't worry, updating the TZ definition won't change that. The shift is still the same.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 08-21-2007, 01:10 PM Re: I got the wrong date
Super Talker

Posts: 116
Name: Paul
Location: South Africa
Trades: 0
Thanks Tripy for the confirmation, i appreciate any and all information I can get my hands on, thanks.
scorpioserve is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I got the wrong date
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24582 seconds with 12 queries