Jump to content

Datefunction


Roy Barten

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.