severndigital Posted October 24, 2007 Share Posted October 24, 2007 I would like to find out what day of the week a certain date falls on. i know the command for doing it for today. $today = date("w"); anyone know how to do it for a variable date? like say 2007-11-25 I can't seem to find that. I can write some whacked out function to it. But i was hoping for an easier way. thanks, chris Link to comment https://forums.phpfreaks.com/topic/74628-solved-date-question/ Share on other sites More sharing options...
only one Posted October 24, 2007 Share Posted October 24, 2007 Yea, the date manual is actually very straight forward: http://uk.php.net/date $today = date("Y-m-d"); Link to comment https://forums.phpfreaks.com/topic/74628-solved-date-question/#findComment-377221 Share on other sites More sharing options...
severndigital Posted October 24, 2007 Author Share Posted October 24, 2007 that would be totally excellent if i need to get the DATE. I need to know what day of the week, that particular date falls on. please read the posts before responding to them. Link to comment https://forums.phpfreaks.com/topic/74628-solved-date-question/#findComment-377223 Share on other sites More sharing options...
only one Posted October 24, 2007 Share Posted October 24, 2007 What do you mean by fall? Link to comment https://forums.phpfreaks.com/topic/74628-solved-date-question/#findComment-377226 Share on other sites More sharing options...
severndigital Posted October 24, 2007 Author Share Posted October 24, 2007 I need to know what day of the week the date 2007-11-25 is on (monday, tuesday, wednesday etc...) Link to comment https://forums.phpfreaks.com/topic/74628-solved-date-question/#findComment-377228 Share on other sites More sharing options...
kenrbnsn Posted October 24, 2007 Share Posted October 24, 2007 Use the function strtotime() in combination with the date() function: <?php $str = '2007-11-25'; echo date('l',strtotime($str)); // that's a lowercase L ?> Ken Link to comment https://forums.phpfreaks.com/topic/74628-solved-date-question/#findComment-377242 Share on other sites More sharing options...
severndigital Posted October 24, 2007 Author Share Posted October 24, 2007 NICE!!! ;D I knew there had to be a way. thanks, chris Link to comment https://forums.phpfreaks.com/topic/74628-solved-date-question/#findComment-377245 Share on other sites More sharing options...
photowborama Posted October 24, 2007 Share Posted October 24, 2007 This line should work.. echo date("D", mktime(0,0,0,11,25,2007)); You can get a lot more sophisticated, but that basically does what you want. There might be an easier way to do it, but I'm really new with PHP myself. Link to comment https://forums.phpfreaks.com/topic/74628-solved-date-question/#findComment-377256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.