[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] reverse localtime



It should be easy to convert julian dates. Assuming $days has the day of the
year and $year is the year:

$seconds = ($days-1) * 24 * 60 * 60;    # seconds from beginning of year
$yearStart = timelocal(0,0,0,1,0,$year);
$time = $yearStart + $seconds;

Now you have the time, you can do what you want.

-K

"To argue with a man who has renounced his reason is like giving medicine to
the dead."
    - Thomas Paine

> From: Ken Williams <ken@forum.swarthmore.edu>
> Date: Thu, 25 May 2000 17:05:51 -0500
> To: Eric Rainey <eric_rainey@wgbh.org>
> Cc: macperl@macperl.org
> Subject: Re: [MacPerl] reverse localtime
> 
> eric_rainey@wgbh.org (Eric Rainey) wrote:
>> Well, it seems that timelocal() requires all of the arguments, when
>> all I have is day of the year.  And timelocal doesn't even seem to
>> support day of year or daylight savings (according to the pod).
> 
> It does daylight savings fine.  But not day of year.
> 
>> It just seems that there's a function out there somewhere...but I
>> reckon I'll just have to think out the math (30 days hath
>> Semptember...)
> 
> Naw, if you do that you'll almost certainly get it wrong, because it's a nasty
> little problem.  Perhaps you'd get it good enough for your purposes, though.
> 
> Perhaps you're interested in Date::Manip (quite a big beast, but quite
> useful) or Date::Calc (which I've never used, but whose name gets thrown
> around quite a bit).
> 
> 
> -------------------                            -------------------
> Ken Williams                             Last Bastion of Euclidity
> ken@forum.swarthmore.edu                            The Math Forum
> 
> 
> 
> # ===== Want to unsubscribe from this list?
> # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org
> 


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org