Solved

Can't handle date problem.

Posted on 2003-12-02
6
540 Views
Last Modified: 2007-12-19
I have absolutely no experience with perl and I have been asked as a last resort to determine why part of the administration of a web site has fallen over.

The error I get is:
Can't handle date (0, 0, 0, 0, 12, 103) at e:\inetpub\vs159156\cgi-bin\fr_shop.plx line 63

The actual line in the code is:
my $endTime = timegm_nocheck (0,0,0,0,1+(gmtime)[4],(gmtime)[5]);

Now, I am not really sure what is wrong the date to make it not want to be able to handle it. I seems though that perhaps that 4th zero should not be there. Does anyone know?
0
Comment
Question by:luthorX
6 Comments
 

Author Comment

by:luthorX
ID: 9863743
Okay, it looks like the month is zero based. Meaning 11 is December and January 0. So 12 is out of bounds.

Looks like the previous coder was a little lazy try to get the next month.
0
 

Author Comment

by:luthorX
ID: 9863844
Problem Solvered.

I just added in a condition for when the month is December so that it just set the day to the 31st.
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9863917
You seem to be doing very well for someone who has absolutely no experience with Perl!

Now that you've solved your problem yourself, you should go to Community Support (that's the CS button on the menu at the top of all Experts Exchange pages), click on Ask a Question, and post a message asking to delete this question and refund your points. Be sure to paste in a link to this question to make it easier for the moderators, but it can be as simple as

http:Q_20814677.html
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 84

Expert Comment

by:ozo
ID: 9864361
my $endTime = timegm_nocheck (0,0,0,0,(1+(gmtime)[4])%12,(1+(gmtime)[4])/12+(gmtime)[5]);
#but there's still a window when the month can tick over between calls to gmtime.  Better to read @g=gmtime; once, then do the arithmetic on $g[4], $g[5]
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10218521
Nothing has happened on this question in more than 8 weeks. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
PAQ, refund points (asker posted their solution -- or accept answer by ozo).

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 10276576
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question