phpdatedate-conversiondate-parsing

Convert "day name" to "day number of the week" (Monday = 1, Tuesday = 2)


Does php have a function to automatically convert dates to their day value?

Examples:

Something like this:

echo func('wednesday'); // 3

Solution

  • $day_of_week = date('N', strtotime('Monday'));