When you code maybe you find difficult to get the week number from a date. Maybe you think of some particular dates and how will you get an algorithm ready for this?

Do not worry! In PHP this function is already done. Here is how to get the week number from a date:

function weeknumber($date){
  $day = new DateTime($date);
  return $day->format("W");



You might find interesting:   Convert minutes to hours and minutes or seconds to minutes and seconds


Please enter your comment!
Please enter your name here