#20596 [Opn->Bgs]: date function gives wrong result for format 't'

From: Date: Sat, 23 Nov 2002 15:57:00 +0000
Subject: #20596 [Opn->Bgs]: date function gives wrong result for format 't'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-25645@lists.php.net to get a copy of this message
ID: 20596 Updated by: derick@php.net Reported By: paul.dodd@unibe.ch -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: WIN 2000 PHP Version: 4.2.1 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. right, not a bug -> bogus Previous Comments: ------------------------------------------------------------------------ [2002-11-23 09:53:52] michael.mauch@gmx.de The second argument of date() should be an integer timestamp, not a string. You can use e.g. mktime() or strtotime() to get such a timestamp: # php -r 'echo date("t", mktime(0,0,0,9,1,2002)),"\n";' 30 ------------------------------------------------------------------------ [2002-11-23 09:30:04] paul.dodd@unibe.ch <?php // As September has 30 days $x, $y & $z should all be // 30 ... instead the result is always 31 // Unfortunately cal_days_in_month is not supported on the // target server (php 4.1.2) even though though the // documentation says it is $x = date('t', '1 Sep 2002'); $y = date('t', 'Sep'); $z = date('t', '2002-09-01'); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20596&edit=1

« previous php.bugs (#25645) next »