homepage Welcome to WebmasterWorld Guest from 54.242.200.172
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
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
*help*
lorax




msg:1288850
 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!

 

lorax




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

Thanks for checking but I figured it out.

GB

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved