Get day of week


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Date format (yyyy/mm/dd)
  2.  
  3. function getWeekDay($date)
  4. {
  5. $date = str_replace("/","-", $date);
  6. list($year, $month, $day) = explode("-", $date);
  7. $week_day = date("w", mktime(0, 0, 0, $month, $day, $year));
  8. return $week_day;
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.