View Full Version : [php] Finding day of week
MTsoul
September 10th, 2004, 11:52 PM
Hey all!
How do I find the day of the week of a certain date?
Thanks
JustJeff
September 11th, 2004, 12:26 AM
http://us4.php.net/manual/en/function.date.php
<?php
// Prints: Friday
echo date("l", mktime(0, 0, 0, 9, 10, 2004));
?>
MTsoul
September 11th, 2004, 07:03 PM
Can I have a result of an integer instead of "Friday" or "Tuesday"? Anything like that? I don't really want an array/function of stuff that turns "friday" into 5.
cmd
September 14th, 2004, 01:24 AM
Can I have a result of an integer instead of "Friday" or "Tuesday"? Anything like that? I don't really want an array/function of stuff that turns "friday" into 5.
sure, just use a switch.
http://us2.php.net/manual/en/control-structures.switch.php
chris
Hans Kilian
September 14th, 2004, 12:30 PM
$weekday = getdate(mktime(0, 0, 0, 9, 10, 2004))["wday"];
0 is sunday, 1 is monday and so on.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.