Does php have a function to automatically convert dates to their day value, where Monday=1, Tuesday=2, etc. Something like this
$daynum = func('wednesday'); //echos 3
Type the formula: =TEXT(A2,”ddd”) if you want the shortened version of the day or =TEXT(A2,”dddd”) if you want the full version of the days. Press the Return key. This should display the day of the week in our required format.
In English, the names are Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday, then returning to Monday. Such a week may be called a planetary week.
Go to the Number tab in the Format Cells dialog box. Select Custom as the Category. Add dddd into the Type field for the full weekday name or ddd for the abbreviated weekday name. Press the OK button.
The date function can return this if you specify the format correctly:
$daynum = date("w", strtotime("wednesday"));
will return 0 for Sunday through to 6 for Saturday.
An alternative format is:
$daynum = date("N", strtotime("wednesday"));
which will return 1 for Monday through to 7 for Sunday (this is the ISO-8601 represensation).
$day_of_week = date('N', strtotime('Monday'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With