aebstract Posted September 11, 2008 Share Posted September 11, 2008 I don't know why it is messing up the way it is, but I am entering in my url: month=November, then I am setting $month = $_GET['month']; Then echo out $month and it displays November. Then I try to do: $date = date('$month 1 Y'); and echo out $date and it gives me: $09o93002 Any answers to why this is doing this and how I can insert the month in to that date variable would be great. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/123807-solved-trouble-with-passing-url-variable-and-date/ Share on other sites More sharing options...
pocobueno1388 Posted September 11, 2008 Share Posted September 11, 2008 You need to use double quotes $date = date("$month 1 Y"); Quote Link to comment https://forums.phpfreaks.com/topic/123807-solved-trouble-with-passing-url-variable-and-date/#findComment-639238 Share on other sites More sharing options...
aebstract Posted September 11, 2008 Author Share Posted September 11, 2008 Okay now I am getting: -0500c30obeThu, 11 Sep 2008 14:25:53 -0500 1 2008 with this: if (isset($_GET['month'])){ $month = $_GET['month']; $date = date("$month 1 Y"); $weekday = date('w', strtotime($date)); echo $date; } else { Quote Link to comment https://forums.phpfreaks.com/topic/123807-solved-trouble-with-passing-url-variable-and-date/#findComment-639242 Share on other sites More sharing options...
BlueSkyIS Posted September 11, 2008 Share Posted September 11, 2008 because month names have date() formatting codes in them. what are you trying to do? it looks like you're just trying to append 1 and the current year to a month name. is that all? Quote Link to comment https://forums.phpfreaks.com/topic/123807-solved-trouble-with-passing-url-variable-and-date/#findComment-639253 Share on other sites More sharing options...
aebstract Posted September 11, 2008 Author Share Posted September 11, 2008 Yeah pretty much the only thing that will change is the month and year, even though I'm not showing year in the example. When I get the month working I will do the year the same way. So when I echo this as $date = date('F 1 Y'); $weekday = date('w', strtotime($date)); echo $date; it is September 1 2008, so yeah same thing with whatever Month I decide to put through to it. Quote Link to comment https://forums.phpfreaks.com/topic/123807-solved-trouble-with-passing-url-variable-and-date/#findComment-639258 Share on other sites More sharing options...
BlueSkyIS Posted September 11, 2008 Share Posted September 11, 2008 like this?? $_GET['month'] = 'November'; $month = $_GET['month']; $date = "$month 1 ".date("Y"); echo "date: $date"; output: date: November 1 2008 Quote Link to comment https://forums.phpfreaks.com/topic/123807-solved-trouble-with-passing-url-variable-and-date/#findComment-639263 Share on other sites More sharing options...
aebstract Posted September 11, 2008 Author Share Posted September 11, 2008 Yes that fixed this issue, thanks Quote Link to comment https://forums.phpfreaks.com/topic/123807-solved-trouble-with-passing-url-variable-and-date/#findComment-639267 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.