|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71888 format date (Y-W) - problem
Submitted: 2016-03-23 13:10 UTC Modified: 2021-06-24 15:18 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: libor at skocik dot cz Assigned: cmb (profile)
Status: Not a bug Package: Date/time related
PHP Version: 5.5.33 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: libor at skocik dot cz
New email:
PHP Version: OS:


 [2016-03-23 13:10 UTC] libor at skocik dot cz
From manual page:

Write for date ("Y-W") from strtotime, setISODate.

Test script:
echo urci_minuly_tyden(2015,2)."-<br /><br /><br />";
echo urci_minuly_tyden2(2015,2)."<br /><br /><br />";

function urci_minuly_tyden($rok,$tyden)

    // return date("Y-m-d",strtotime('2015W02 -1 week'));
    return date("Y-W",strtotime('2015W02 -1 week'));


function urci_minuly_tyden2($rok,$tyden)
    $week_start = new DateTime();
    $week_start->modify('-7 days');
    //return $week_start->format('d-m-Y');
    return ($week_start->format('Y-W'));


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-24 09:32 UTC] libor at skocik dot cz
solution code:

echo last_week (2015,2)."<br /><br /><br />";

function last_week($rok,$tyden)
    $week_start = new DateTime();
    $week_start->modify('-1 week');


    if ($month=='12' && $week=='01')
    elseif ($month=='01' && $week=='52')
    return (string)$year.'-'.$week;
 [2016-03-24 09:37 UTC]
-Package: date_time +Package: Date/time related
 [2021-06-24 15:18 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-06-24 15:18 UTC]
Proper solution: "o-W"
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 21:01:33 2024 UTC