LinuxAnswers - the LQ Linux tutorial section.
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org Php days calculation
 User Name Remember Me? Password
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 10-19-2006, 04:57 AM #1 dylan912 LQ Newbie   Registered: Dec 2004 Distribution: Redhat Posts: 18 Rep: Php days calculation Hi all, How do I calculate the total days by given a date and to present day. Example Given date = 10-10-2006 Currant date = 19-10-2006 (this should define automatically) So total days = 9 If 20-10-2006 it should print 10 This should print total days from the start we enter the date (given date) Please help
 10-19-2006, 05:57 AM #2 hobey LQ Newbie   Registered: Feb 2006 Distribution: SuSE 10.0 Posts: 17 Rep: You could use 'mktime' to get unix timestamps for the two dates. Then compute the difference between the timestamps and you have the seconds between the two dates. Divide by 60*60*24=86400 to get the difference in days.