Hi
I'm doing my head in trying to figure what process i need to use to simply get the day-of-the-week number (eg 0 for sunday, 1 for monday etc) from a date formatted as YYYY-MM-DD
I think i need need to use strtotime() but i can't work out what i'd need to do with it
can anyone help ?
thanks
in the end i did it like this
$parts = explode("-",$date); $dNum = date("w", mktime(0, 0, 0, $parts[1], $parts[2], $parts[1]));
but it seems a bit kludgy using explode() when there must be a better way, no ?
Perhaps:
$dNum = date('w', strtotime($date));
yes - you're right again
I had tried several combinations using date(), strtotime(), strfrtime(), mktime() etc etc and i couldn't find the right one
is it just me or does everyone find the date functions hard to get to grips with ?
anyway, thanks 🙂