You can use
$dayisarr=date( "l", strtotime($duedt[2] . '-' . $duedt[1] . '-' . $duedt[0]));
문제
I'm trying to get a date from a html, and i use mktime to convert it to a day like: Monday
$dayisarr=date( "l", mktime(0,0,0, $duedt[1], $duedt[0],$duedt[2] ));
when i print it , it returns me a wrong day...like Friday
which is wrong..
i tried to change the l
to r
, which prints the whole date and it printed me the wrong month and year.. ive searched for a long long time in the internet and i didnt find nothing.
해결책 2
You can use
$dayisarr=date( "l", strtotime($duedt[2] . '-' . $duedt[1] . '-' . $duedt[0]));
다른 팁
Why use mktime? DateTime is far simpler.
$duedt = array(8, 14, 2013);
$dayisar = (new \DateTime())->setDate($duedt[2], $duedt[0], $duedt[1])->format('l');
var_dump($dayisar);
Output:-
string 'Wednesday' (length=9)