2016-07-30 58 views
0

我有一個變量$年周,我會得到一週的一天:例如:獲取星期從年周在PHP

$yearweek = 201630 
$monday = '2016-07-25' 
$thuesday = '2016-07-26' 
... 
+0

請有關問題的解釋 – jophab

回答

0
# 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'); 
相關問題