LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 11-04-2002, 09:49 PM   #1
GabeF
Member
 
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
leed_25
Member
 
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
GabeF
Member
 
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:

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

And here is my new one:

Code:
$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.
 
  


Reply


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


All times are GMT -5. The time now is 06:27 AM.

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