[PHP] subtracting time from date and time

2007-06-18 Thread Richard Kurth
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

Re: [PHP] subtracting time from date and time

2007-06-18 Thread Brad Bonkoski
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 =

Re: [PHP] subtracting time from date and time

2007-06-18 Thread Chris Boget
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); ? Even easier: $timestamp = strtotime( $str );

RE: [PHP] subtracting time from date and time

2007-06-18 Thread Richard Kurth
-Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED] Sent: Monday, June 18, 2007 10:55 AM To: Brad Bonkoski; Richard Kurth Cc: php-general@lists.php.net Subject: Re: [PHP] subtracting time from date and time Something like this will get it into a time stamp

RE: [PHP] subtracting time from date and time

2007-06-18 Thread Chris Boget
This works great tell you get to 8 hours ago it shows the correct time but it does not change the date to the day before. 8 hours ago should be 06/16/2007 11:35:00 but what it shows is 06/17/2007 11:35:00 Your code works for me. Though, I had to change the format of $str slightly to get

Re: [PHP] subtracting time from date and time

2007-06-18 Thread Jim Lucas
Richard Kurth wrote: -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED] Sent: Monday, June 18, 2007 10:55 AM To: Brad Bonkoski; Richard Kurth Cc: php-general@lists.php.net Subject: Re: [PHP] subtracting time from date and time Something like this will get it into a time

RE: [PHP] subtracting time from date and time

2007-06-18 Thread Richard Kurth
] subtracting time from date and time Richard Kurth wrote: -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED] Sent: Monday, June 18, 2007 10:55 AM To: Brad Bonkoski; Richard Kurth Cc: php-general@lists.php.net Subject: Re: [PHP] subtracting time from date and time