mattichu Posted March 13, 2012 Share Posted March 13, 2012 Hi! the following code sucessfully outputs a timestamp. $datealt=strtotime('2012-03-13 ,23:13:00'); The following however does not: $datealt=strtotime('$date ,$hours:$minutes:00'); I have checked if the variables echo out and they do.. any clues much appreciated x Link to comment https://forums.phpfreaks.com/topic/258791-strtotime-using-variables/ Share on other sites More sharing options...
scootstah Posted March 13, 2012 Share Posted March 13, 2012 You can't use variables in single quotes without concatenating. So do either this: $datealt=strtotime("$date ,$hours:$minutes:00"); or this: $datealt=strtotime($date . ' ,' . $hours . ':' . $minutes . ':00'); Link to comment https://forums.phpfreaks.com/topic/258791-strtotime-using-variables/#findComment-1326660 Share on other sites More sharing options...
mattichu Posted March 13, 2012 Author Share Posted March 13, 2012 thankyou! Link to comment https://forums.phpfreaks.com/topic/258791-strtotime-using-variables/#findComment-1326664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.