php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78616 unexpected behaviour of date function
Submitted: 2019-10-01 06:45 UTC Modified: 2019-10-01 07:42 UTC
From: tanmuhittin at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS: ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tanmuhittin at gmail dot com
New email:
PHP Version: OS:

 

 [2019-10-01 06:45 UTC] tanmuhittin at gmail dot com
Description:
------------
especially when using date function with strtotime this behavior may result problems since strtotime returns false when invalid argument is supplied but date function will not

Test script:
---------------
<?php
echo date('Y-m-d',false);
echo date('Y-m-d',0);

Expected result:
----------------
false
01-01-1970

Actual result:
--------------
01-01-1970
01-01-1970

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-01 07:42 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2019-10-01 07:42 UTC] cmb@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

See <https://www.php.net/manual/en/language.types.integer.php#language.types.integer.casting.from-boolean>.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 13:01:28 2025 UTC