|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-11-23 09:30 UTC] paul dot dodd at unibe dot 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');
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 14:00:02 2025 UTC |
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