Bug #18115 Updated: timestamp of the 1st of one month, gets valued as previous month

From: Date: Tue, 02 Jul 2002 19:46:34 +0000
Subject: Bug #18115 Updated: timestamp of the 1st of one month, gets valued as previous month
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12853@lists.php.net to get a copy of this message
ID: 18115 Updated by: randy@careerstep.com Reported By: randy@careerstep.com -Status: Bogus +Status: Open Bug Type: *Calendar problems Operating System: FreeBSD PHP Version: 4.0CVS-2002-07-02 New Comment: Addionally, I've since descovered that when PHP gets a timestamp from a UNIX file that was created/modified on the first day of any month ( use ls -al from the command line to verify the actual date modified), PHP returns the mday (in the case of getdate()), or "d" (in the case of date()) as being the last day of the PREVIOUS month + 1 day, instead of returning 1, which is the actual day of modification/creation. It doesn't even try to claim it's day 0. It just invents an imaginary day for the previous month and returns that. It also gets the "m" (date()), or 'mon' and 'month' (getdate()) values wrong, returning them as those of the previous month. Try using date("m - d", $timestamp_from_unix_file); if you don't believe me. Previous Comments: ------------------------------------------------------------------------ [2002-07-02 13:19:18] jan@php.net Sorry, but the bug system is not the appropriate forum for asking support questions. 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 Thank you for your interest in PHP. ------------------------------------------------------------------------ [2002-07-02 13:11:46] randy@careerstep.com Lets say you have a directory of 1000 files give or take any number, and you want to archive (or delete) many of those files by month. Each file contains a time stamp of when it was last modified. If I create a new directory called January and take use each time stamp to tell me which ones where last modified in the month January, then it returns all files in January and Feb 1st. The same thing with all the other months. I've tried this using the date and getdate function, and have had the same problem. It acts like the date for PHP is one day off the date of FreeBSD. I've tested it on 2 different FreeBSD servers. When I use the php functions to get the time for the first of the month, everything works well. But when I use the time stamp associated with a file, then it's one day off. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18115&edit=1

« previous php.bugs (#12853) next »