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:   Twitter Style “Time Ago” Dates on PHP

NO COMMENTS

LEAVE A REPLY