php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53299 strtotime expects date format to be MM/DD/YYYY even though timezone set to GMT
Submitted: 2010-11-12 14:02 UTC Modified: 2010-11-12 15:56 UTC
From: d dot reade at ReadesGroupServices dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3.3 OS: CentOS 5.5
Private report: No CVE-ID: None
 [2010-11-12 14:02 UTC] d dot reade at ReadesGroupServices dot com
Description:
------------
Using strtotime() to convert a UK date stamp (DD/MM/YYYY) but getting null or incorrect date.

Test script:
---------------
<?
ini_set('date.timezone', 'Europe/London');

$time = strtotime('31/08/2010');
$date = date('jS M Y', $time);

echo $date;
?>

Expected result:
----------------
31st Aug 2010

Actual result:
--------------
1st Jan 1970

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-12 15:56 UTC] derick@php.net
-Status: Open +Status: Bogus
 [2010-11-12 15:56 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Timezones don't affect parsing formats. The formats used for parsing are always the same. You want to have a look at:
http://uk.php.net/manual/en/datetime.createfromformat.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 18:01:28 2024 UTC