How to get weeks starting on sunday?

前端 未结 9 1662
甜味超标
甜味超标 2020-12-03 19:25

I need to get week number in php where week should be calculated from sunday. By default its from monday. Please help me to find a way how to get week number considering sun

9条回答
  •  天涯浪人
    2020-12-03 19:52

    The first solution is not correct on Jan 01, 2017 or any year that begins on a Sunday.

    Try this:

    $date = date('Y-m-d');
    echo strftime("%U", strtotime($date ) );
    

提交回复
热议问题