Get the Week Number From A Date in PHP

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");



Leave a Reply

Your email address will not be published. Required fields are marked *