Re: time()

From: Date: Tue, 06 Mar 2001 17:25:55 +0000
Subject: Re: time()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42782@lists.php.net to get a copy of this message
Hi Augusto, This is a quick hack (nobody freak out please!) that will hopefully explain this question and your other recent thread. Without further ado, play with this : <?php $seconds = array ('day' => 60*60*24, 'week' => 60*60*24*7, 'month' => 60*60*24*30, 'year' => 60*60*24*365, 'decade' => 60*60*24*365*10); testTime($seconds); function testTime($times,$format='l dS of F Y h:i:s A') { echo 'Current time() : '. time(); echo '<h3>Future Times</h3><ul>'; foreach ($times as $type => $value) { echo '<li>'. $type . ' : ' . date($format,time()+$value); } echo '</ul>'; echo '<h3>Past Times</h3><ul>'; foreach ($times as $type => $value) { echo '<li>'. $type . ' : ' . date($format,time()-$value); } echo '</ul>'; } ?> If it doesn't make sense, just say so. But essentially, timestamps are very cool and important! Time() returns such a beast. It returns the number of seconds since this date, we call it the EPOCH (*bows*) : January 1 1970 00:00:00 GMT Read about it here : http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=epoch Regards, Philip Olson http://www.cornado.com/ On Tue, 6 Mar 2001, Augusto Cesar Castoldi wrote: > I'm trying to do a session with MySQL. > > how works the funtion time? I didn't undertood the manual. > > that number is a date, time, seconds?? What is it? > > regards, > > Augusto > > > -- > 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 >

« previous php.general (#42782) next »