Welcome to WebmasterWorld Guest from 107.20.75.63

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Unix Timestamps in PHP

*help*

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

Senior Member from US 

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

joined:Mar 31, 2002
posts:7575
votes: 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 Sept 11, 2002 (gmt 0)

Senior Member from US 

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

joined:Mar 31, 2002
posts:7575
votes: 0


Thanks for checking but I figured it out.

GB