gple Posted May 12, 2008 Share Posted May 12, 2008 If I have a variable that is a date (2004-01-01). How do I get the day of the week in which that date falls on. Link to comment https://forums.phpfreaks.com/topic/105281-get-day-from-a-date/ Share on other sites More sharing options...
revraz Posted May 12, 2008 Share Posted May 12, 2008 http://us3.php.net/strtotime Link to comment https://forums.phpfreaks.com/topic/105281-get-day-from-a-date/#findComment-539091 Share on other sites More sharing options...
soycharliente Posted May 12, 2008 Share Posted May 12, 2008 You're looking for the date() function. <?php $var = "2004-01-01"; echo date("l", $var); // lowercase L, a full textual representation of the day of the week ?> Link to comment https://forums.phpfreaks.com/topic/105281-get-day-from-a-date/#findComment-539234 Share on other sites More sharing options...
kenrbnsn Posted May 12, 2008 Share Posted May 12, 2008 That won't work, since the date() function is expecting to see a UNIX time stamp (integer) for the second parameter. Use: <?php $var = "2004-01-01"; echo date("l", strtotime($var)); // lowercase L, a full textual representation of the day of the week ?> instead. Ken Link to comment https://forums.phpfreaks.com/topic/105281-get-day-from-a-date/#findComment-539236 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.