firman
08-09-2007, 03:25 PM
If I have a value of 2006-04-06 and I wanted to find out what 30 or 60 or 73 or whatever many days before that was... How would I write that code?
|
Click to See Complete Forum and Search --> : find date that was 30 days ago. firman 08-09-2007, 03:25 PM If I have a value of 2006-04-06 and I wanted to find out what 30 or 60 or 73 or whatever many days before that was... How would I write that code? ellisgl 08-09-2007, 04:36 PM Convert the date to a time stamp. $stamp = mktime(0,0,0,$mon,$day,$year); Figure out how many seconds to subtract from. $a = 86400*$days; $b = $stamp - $a; Then convert the time stamp with date $c = date ( "Y-m-d", $b); NogDog 08-09-2007, 11:26 PM $date = '2006-04-06'; $thirtyDaysAgo = strtotime('-30 days', strtotime($date)); webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |