Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-04-2002, 09:49 PM   #1
Registered: Mar 2002
Location: New Hampshire, US
Distribution: Mandrake 8.0, Redhat 8.0
Posts: 101

Rep: Reputation: 15
PHP last time modified script time way off

I am just starting out with PHP, and wanted to write a very simple (how many scripts are one liners?) script to do just that. It displays the time, but the the wrong one. For example:

December 31 1969 7:00:00 when the date was actually
November 5 2002 10:50.

Anybody have any pointers? Thanks
Old 11-05-2002, 01:22 PM   #2
Registered: Jul 2002
Location: san francisco
Distribution: freebsd
Posts: 102

Rep: Reputation: 17
Can you show us your script? Here's what seems a little odd to me right off the bat: that date --December 31 1969 7:00:00-- is the day before the epoch --jan 1 1970 00:00:00--, so I'd be willing to bet that you're probably passing a negative number to the date print function.
Old 11-05-2002, 08:05 PM   #3
Registered: Mar 2002
Location: New Hampshire, US
Distribution: Mandrake 8.0, Redhat 8.0
Posts: 101

Original Poster
Rep: Reputation: 15
I just figured it out. Here was my old script:

echo date( "F d Y h:i:s", getlastmod() );
lol nice and short.

And here is my new one:

$last_modified = filemtime("<filename>");
print("Last Modified: ");
print(date("m/j/y h:i", $last_modified));
I don't see anything wrong with the first, but I don't know a whole lot about php syntax either.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Doub about `net time set` and daylight saving time Thakowbbery Linux - Software 0 10-17-2005 05:23 AM
Socket doesn't time out. (PHP) laserbeamninja Programming 0 04-18-2005 03:23 PM
time modified when booting xround Linux - General 4 08-11-2004 09:24 AM
no signal when starting xorg for the 1st time (but the second time works fine) bungalowbill Linux - Software 0 06-04-2004 09:56 AM
Where can I look for the config file for modified date and time ForumKid Linux - General 1 09-19-2003 08:05 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration