homepage Welcome to WebmasterWorld Guest from 50.17.7.84
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
strtotime problem when clocks change
ahmed24




msg:4537469
 4:59 pm on Jan 19, 2013 (gmt 0)

i'm using the strtotime function to convert a date and time like this:

strtotime("20-APR-2013 13:15") so that a calendar application can use it

only problem is that because this date is in the future after the clocks change, it ends up translating to 14:15 instead of 13:15. I am assuming when the clocks on the server change to match, everything will be fine, but then the problem will be that the past dates will end up being. wrong. Is there anyway around this problem?

thanks

 

coopster




msg:4537796
 9:40 pm on Jan 20, 2013 (gmt 0)

From the manual page: [php.net...]

Each parameter of this function uses the default time zone unless a time zone is specified in that parameter. Be careful not to use different time zones in each parameter unless that is intended. See date_default_timezone_get() on the various ways to define the default time zone.


You are likely going to need to be more specific with your time string. See the Date and Time Format page for more information:

[php.net...]

g1smd




msg:4537803
 9:58 pm on Jan 20, 2013 (gmt 0)

Try to do everything internally in UTC if you can. UTC is a time scale with no DST changes.

You can then convert to and from a local date/time as you need it.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved