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 Quote 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'); Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/258791-strtotime-using-variables/#findComment-1326664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.