perl -MCPAN -e 'install Date::Calc' perl -MCPAN -e 'install Date::Parse' (you forgot your install command)
OR
type cpan from the prompt then the 2 install packages [prompt]$ cpan cpan> install Date::Calc cpan> install Date::Parse
----- Original Message ----- From: "Stephen Liu" <[EMAIL PROTECTED]>
To: "'Perl Beginners List'" <[EMAIL PROTECTED]>
Sent: Monday, November 22, 2004 3:11 PM
Subject: RE: Date calculations and daylight saving
Hi John,
Please advise where can I find following modules
Date::Calc date::parse
I can't find them with
# perl MCPAN -e 'Date::Calc' Can't open perl script "MCPAN": No such file or directory # perl -MCPAN -e 'Date::Calc' # perl -MCPAN -e 'date::parse' # perl MCPAN -e 'date::parse' Can't open perl script "MCPAN": No such file or directory # perl MCPAN -e 'Date::Parse' Can't open perl script "MCPAN": No such file or directory # perl -MCPAN -e 'Date::Parse'
Thanks
B.R. Stephen Liu
--- John Bruin <[EMAIL PROTECTED]> wrote:
> -----Original Message-----
> From: Bob Showalter
[mailto:[EMAIL PROTECTED] > Sent: 20 November 2004 02:35
> To: 'John Bruin'; 'Perl Beginners List'
> Subject: RE: Date calculations and daylight saving
> > John Bruin wrote:
> > I have a script that calculates difference
between dates > and it works > > well. However if the 2 dates straddle our
daylight saving times > > (March, October) then the result is either plus
or minus an hour > > compared to the expected result.
> > Are you subtracting "dates" or "local time
stamps?" In the > abstract, "dates"
> have no reference to time zones.
> > Give some examples of what you're trying to do.
What is the > "expected result"?
> > If you switch from daylight savings time at 2am on
Sunday, > October 31, then the difference between the local
times of > noon on Saturday the 30th and noon on Sunday the
31st is 25 > hours, not 24 hours. If you're expecting it to be
> 24 hours, that's not correct.
>
Yes this is exactly what I am try to do. I am working out how long jobs take to complete and I need 1 day to equal 24 hrs and a week to equal 168 hrs regardless of daylight saving change overs. We used to use a spreadsheet for this calculation and that's what we're trying to duplicate. Technically inaccurate yes but for our purposes it gives the expected result.
> > > > I am using date::parse (which uses Time::Local)
to convert the date > > string to seconds and then localtime and
strftime to > convert back to a > > string.
> > What are you converting back to a string? The
difference > between the epoch seconds?
>
Yes I convert the string to epoch seconds and calculate the difference between the 2 dates. Then I add up how much time has been spent on that particular job and how much time remains to meet the target completion time. We get penalised if we pass this target completion time so the script calculates the time and date each job should be finished based on the time remaining.
> Note that epoch seconds are always in GMT (UTC).
In order for > your parsing routine to convert a string expressed
in some > local time to epoch seconds, it needs to know the
offset from > the local time to GMT, which is a function of the
time zone.
>
Is what I am attempting to do feasible? Currently I am looking at Date::Calc to see if I can do the calculations without offsetting for local time etc.
Thanks John
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>