2

How do you check whether a date in the US format of e.g. 2012-01-01 falls on a weekday or weekend in PHP?

methuselah
  • 12,766
  • 47
  • 165
  • 315
  • possible duplicate of [Checking if date is weekend PHP](http://stackoverflow.com/questions/4802335/checking-if-date-is-weekend-php) – JJJ Mar 04 '12 at 09:20

1 Answers1

11
$weekday = date("w", strtotime("2012-01-01"));

This will be 0 for Sunday through 6, Saturday.

http://www.php.net/manual/en/function.strtotime.php

http://php.net/manual/en/function.date.php

Jordan
  • 31,971
  • 6
  • 56
  • 67