CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Today is Feb 17, 2001 but prints Feb 18, 2001 Why?

 



keith2045
Deleted

Feb 17, 2001, 4:44 PM

Post #1 of 5 (293 views)
Today is Feb 17, 2001 but prints Feb 18, 2001 Why? Can't Post

I have a reviews script where users review programs, the script prints it with the date, well it is printing the wrong day why? you can see the script in action at http://www.mycashworld.com/reviews/aaruka.cgi and here's the date script

@days = ("Sunday","Monday","Tuesday","Wednesday","Thursday",
"Friday","Saturday");
@months = ("January","February","March","April","May","June",
"July","August","September","October","November",
"December");

($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
$year = $year + 1900;
print "$months[$mon] $mday, $year\n";

Thanks

Keith



muinatit
Deleted

Feb 17, 2001, 5:58 PM

Post #2 of 5 (292 views)
Re: Today is Feb 17, 2001 but prints Feb 18, 2001 Why? [In reply to] Can't Post

Probably because your server is probably ahead of you in time. It's not your code, its the server.

Jeffrey "muinatit" Lamoureux
muinatit@hotpop.com


Aquilo
journeyman

Feb 20, 2001, 2:37 PM

Post #3 of 5 (283 views)
Re: Today is Feb 17, 2001 but prints Feb 18, 2001 Why? [In reply to] Can't Post

muinatit is right try offsetting the time!
gatta go or i'd hunt down the code!



muinatit
Deleted

Feb 20, 2001, 3:39 PM

Post #4 of 5 (282 views)
Re: Today is Feb 17, 2001 but prints Feb 18, 2001 Why? [In reply to] Can't Post


Code
localtime(time +3000);

I think that will boost the clock 3 hours. But i'm not sure.

Jeffrey "muinatit" Lamoureux
muinatit@hotpop.com


muinatit
Deleted

Feb 20, 2001, 5:41 PM

Post #5 of 5 (280 views)
Re: Today is Feb 17, 2001 but prints Feb 18, 2001 Why? [In reply to] Can't Post

I figured it out....

localtime(time + 3600);

So to add one hour you go like this..

+ 3600

and to subtract one hour..

- 3600

And you multiply 3600 times however many hours you want to add or subtract and youhave your answer.

Jeffrey "muinatit" Lamoureux
muinatit@hotpop.com

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives