簡體   English   中英

從PHP中的yearweek獲取星期幾

[英]Get day of week from yearweek in PHP

我有一個可變的$ yearweek,我可以得到星期幾:例如:

$yearweek = 201630
$monday   = '2016-07-25'
$thuesday = '2016-07-26'
...
    # Create new DateTime object
    $date = new DateTime();

    # Get Week start date (monday)
    $arr['monday']  = $date->setISODate(2016, 30)->format('d-m-Y');

    # For example this is sunday, you can do this for all days by changing +6
    $arr['sunday']  = $date->modify('+6 days')->format('d-m-Y');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM