PHP day of week numeric to day of week text

前端 未结 7 627
不思量自难忘°
不思量自难忘° 2020-12-01 11:33

This may be really easy but I can\'t find a PHP function to do this...

OK so

$dow_numeric = date(\'w\');

gives the numeric day of t

相关标签:
7条回答
  • 2020-12-01 12:36

    Create an array to map numeric DOWs to text DOWs.

    $dowMap = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
    

    If you need locale support, load the dow of some random date (epoch (0) would be a good date for example) and then for the next 6 days and build the dow map dynamically.

    0 讨论(0)
提交回复
热议问题