#20596 [Com]: date function gives wrong result for format 't'

From: Date: Sat, 23 Nov 2002 15:53:53 +0000
Subject: #20596 [Com]: date function gives wrong result for format 't'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-25644@lists.php.net to get a copy of this message
ID: 20596 Comment by: michael.mauch@gmx.de Reported By: paul.dodd@unibe.ch Status: Open Bug Type: Date/time related Operating System: WIN 2000 PHP Version: 4.2.1 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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 (#25644) next »