Re: subtracting time from date and time

From: Date: Mon, 18 Jun 2007 17:43:15 +0000
Subject: Re: subtracting time from date and time
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-257325@lists.php.net to get a copy of this message
Something like this will get it into a time stamp...and then you can do your calculations with ease, and reformat... <?php
       $str = "20070617T193500";
       list($date, $time) = explode("T",$str);
       $year = substr($date, 0, 4);
       $mon = substr($date, 4, 2);
       $day = substr($date, 6,2);
       echo "$year - $mon - $day\n";
       $h = substr($time, 0, 2);
       $m = substr($time, 2, 2);
       $s = substr($time, 4,2);
       echo "$h : $m: $s\n";
       $ts = mktime($h,$m,$s,$mon,$day,$year);
?> -Brad Richard Kurth wrote:
I am trying to figure out what is the most accurate way to find the time after I subtract 5 min,15 min, 30 min 1 hour 2 hours and 5 hours from a date and time that is formatted like this 20070617T193500 this is the way it has to be formatted to work in a vcalendar


« previous php.general (#257325) next »