Retrieving Day Names in PHP

前端 未结 7 603
-上瘾入骨i
-上瘾入骨i 2021-01-11 15:44

I need to display to user a list of localized day names (like \'Monday\', \'Tuesday\', ...) in a form. I know ho to get day name of any date. But is there a particular and f

7条回答
  •  走了就别回头了
    2021-01-11 16:25

    $dayNames = array(
        'Sunday',
        'Monday', 
        'Tuesday', 
        'Wednesday', 
        'Thursday', 
        'Friday', 
        'Saturday', 
     );
    

    Is pretty fail-proof :)

    On a more serious note, the likes of PHPBB do this by defining localization files and hard coding for different languages. It's really the only way to do this reliably.

    I would recommend downloading something like that and looking at the code to see how its done.

    http://www.phpbb.com/downloads/olympus.php

提交回复
热议问题