Vernersson Posted November 6, 2007 Share Posted November 6, 2007 I'm new to PHP and have been trying to understand how to implent the offical PHP resource texts about mktime but i don't get it.This is the current code:$rem_img = "../img/rem.gif";$sDate = $row['paminnelseDatum'] - $row['PaminnelseDagar'];list($month, $day, $year) = split('[/.-]', $sDate);$alt_txt = "Påminnelse " . date("1", mktime(0, 0, 0, $month, $day, $year)) . " den " . $day . " " . $month . " " . $year;$row['paminnelseDatum'] och $row['PaminnelseDagar'] innehåller datum av typen 06-06-2006 samt 05-05-2005And the error i get is this:Warning: mktime() expects parameter 4 to be long, string given in test.phphow should i put the code in order to get it to work?Many thanks! Link to comment Share on other sites More sharing options...
Jesdisciple Posted November 6, 2007 Share Posted November 6, 2007 That's not the whole page, right? I would like to reproduce your error, and think I need more code to do that. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 6, 2007 Share Posted November 6, 2007 $month, $day, and $year are strings that were the result of a split operation. mktime expects numbers, not strings. You can convert them like this:mktime(0, 0, 0, intval($month), intval($day), intval($year))Also make sure that you are passing mktime numbers, you don't send "January" for the month, you send 1. February is 2, etc. Link to comment Share on other sites More sharing options...
Vernersson Posted November 6, 2007 Author Share Posted November 6, 2007 $month, $day, and $year are strings that were the result of a split operation. mktime expects numbers, not strings. You can convert them like this:mktime(0, 0, 0, intval($month), intval($day), intval($year))Also make sure that you are passing mktime numbers, you don't send "January" for the month, you send 1. February is 2, etc.ah, I see, thanks alot! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.