Roy Barten Posted February 17, 2009 Share Posted February 17, 2009 oke, now i have the following problem. I have a variable and i convert it to a date, but after i convert it to a date, one hour must be added by this date. To convert the variable to a date, i built the following function: function ConvertToDateTime($number,$calendartype) { if ($calendartype == "week"){ $time = date("$number:00:00 2009-03-02"); $date = strtotime($time); } if ($calendartype == "month"){ $day = date("00:00:00 2009-03-$number"); $date = strtotime($day); } return $date; } How do i add just one hour up to this result? Link to comment https://forums.phpfreaks.com/topic/145551-datefunction/ Share on other sites More sharing options...
cola Posted February 17, 2009 Share Posted February 17, 2009 Try this. function ConvertToDateTime($number,$calendartype) { if ($calendartype == "week"){ $number=$number + 01; $time = date("$number:00:00 2009-03-02"); $date = strtotime($time); } if ($calendartype == "month"){ $number=00+01; $day = date("$number:00:00 2009-03-$number"); $date = strtotime($day); } return $date; } Link to comment https://forums.phpfreaks.com/topic/145551-datefunction/#findComment-764128 Share on other sites More sharing options...
cola Posted February 17, 2009 Share Posted February 17, 2009 function ConvertToDateTime($number,$calendartype) { if ($calendartype == "week"){ $number=$number + 01; $time = date("$number:00:00 2009-03-02"); $date = strtotime($time); } if ($calendartype == "month"){ $number2=00+01; $day = date("$number2:00:00 2009-03-$number"); $date = strtotime($day); } return $date; } Link to comment https://forums.phpfreaks.com/topic/145551-datefunction/#findComment-764130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.