Re: date difference

From: Date: Thu, 15 Jul 2004 20:57:30 +0000
Subject: Re: date difference
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-190631@lists.php.net to get a copy of this message
"John Meyer" <jmeyer2003@msn.com> wrote in message news:BAY11-F14k3wJ8orsYK000dd031@hotmail.com... > Hello, > Is there a function to determine the difference between two dates? I am > asking so I can do some date verification for COPA. Convert your dates to timestamps which will be 10-digit integers (the time since 1.1.1970 in seconds) you can then substract/add them like normal numbers. $date = '2004-07-15 01:00:00'; $date2 = '2004-07-15 02:00:00'; $timestamp = strtotime($date); $timestamp2 = strtotime($date2); echo $timestamp2 - $timestamp1; // will output 3600 (seconds) Hope this helps. Regards, Torsten Roehr

« previous php.general (#190631) next »