Welcome to WebmasterWorld Guest from 54.205.20.160

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Unix Timestamps in PHP

*help*

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

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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)

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Thanks for checking but I figured it out.

GB

 

Featured Threads

Hot Threads This Week

Hot Threads This Month