Re: dates

From: Date: Mon, 19 Feb 2001 02:12:53 +0000
Subject: Re: dates
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-40495@lists.php.net to get a copy of this message
On Sun, Feb 18, 2001 at 06:54:02PM -0700, Julian Rockey wrote: > Yes I had a look at mktime() and date() and tried to think of an easy > way to do it but couldn't... you can convert both dates to a UNIX > timestamp (millseconds after whatever date) then do a subtraction... and > then what? Easy to work out number of days from millseconds as a day's > length is fixed but to go to months is harder as of course you need more > information than just the actual elapsed time. Similar problam with > mktime() as it's designed for actual dates, not differences between days. The Unix timestamp is in seconds after midnight January 1 1970. A approximatley calculation can be done with seconds. One minute has 60 seconds and 60 minutes are one hour. One day have 24 hours. But 24 hours times 7 days are not everytime a week and you should know a year has sometimes 365 days and sometimes 366 days. All calendar programs which are spret with GNU/Linux have some knowledge about the deviations. > What is XEmacs calc- mode and calendar mode? I'm not all that familiar > with Unix I'm afraid.. I think you can use XEmacs on all Windows operating systems. If I have time, I will install such a great editor on my Windows ME. Windows Notepad is such a pain. -Egon > eschmid+sic@s.netic.de wrote: > > > On Sun, Feb 18, 2001 at 04:40:08PM -0700, Julian Rockeu wrote: > > > >> Anyone know how to use the PHP date functions to work out the difference > >> between two timestamps? > >> > >> For example.. > >> > >> Figure out the number of seconds, minutes, hours, days, months and years > >> between > >> > >> 5th October 2001 14:20:10 > >> and > >> 26th February 1998 109:54:10 > > > > > > This should be doable with http://php.net/mktime and > > http://php.net/date. But > > for such heavy calculations I prefer XEmacs calc-mode or the calendarr-mode. > > > > -Egon > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- -- http://www.linuxtag.de/ http://php.net/books.php http://www.concert-band.de/ http://www.php-buch.de/

« previous php.general (#40495) next »