Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Kenny Halley
February 11, 2005, 3:23 am
rate this thread
languages in the past but can't seem to find my way round them, but for once
I feel I am getting somewhere with php and have written my first functional
program that does something useful (well for me anyway!).
The purpose of the program is to read some logfiles we import to our
webserver and parse out some lines which are displayed on a website (near
real time stats essentially)
All this works fine but one part of my output does not read as I would
When my script reads each logfile it also picks up the date and time of the
last modified time of the file. As these logs are replaced every 10 minutes
its important I can see when the latest stats are essentially. I use the
The basic funtionality seems to work but the time I get out is odd. I have
broken my code down to a simple read the file time and print it on screen
but this returns the same time.
If I telnet to the server and read the last modded time it says (at present
10:22) But my php script outputs 10:02. This seems to stay like this for an
hour then outputs 11:02.
Its like it only sees hourly changes (always at 2 mins past the hour) I
thought it might be some sort of cacheing so have called clearstatcache() in
my script but this makes no difference. What time is this showing me here
then if its not the true system file modification time? any ideas?
- Senator Jay Billington Bulwort
February 11, 2005, 11:46 am
Re: Problem with filemtime- am I missing something?
You keep getting 02 because it's February.
OK, I was tempted to stop there and give your brain a workout ;) but I
guess I'll toss in the explanation. When using date functions, 'm'
represents the month in numeric form, not the minute. You want to use
'i' to get the minute, e.g.
echo date('Y-m-d H:i');
Bulworth : PHP/MySQL/Unix | Email : str_rot13('firstname.lastname@example.org');
<http://www.phplabs.com/ | PHP scripts, webmaster resources