homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
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

Unix Timestamps in PHP

 7:42 pm on Sep 11, 2002 (gmt 0)

I've written a script to count the number of days between an event and today. It's my understanding the best way to work with date comparisons is to convert everything to Unix Timestamp and then do the calcs. The problem is that I can't seem to get the conversion to work. The code for the conversion from to Unix Timestamp is:

$then_ux = mktime("","","",date("n,d,Y",strtotime($followup["fdate"])));

This seems more complicated than it needs to be.

The conversion from Unix to text is getdate($then_ux) -- to verify the first conversion -- gives me a date that's 8 days earlier.

fdate comes from a MySQL DATE field. I've thought of using Date_Format() in the query but can't use it because I need to keep the date the way it is for other reasons.

Any thoughts would be appreciated!



 8:20 pm on Sep 11, 2002 (gmt 0)

Thanks for checking but I figured it out.


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