Re: DateTime from Rata Die?
A shorter one: --- my $from_rd = DateTime->new(year => 1)->add(days => $rd_days); --- A shorter class for Dave's program: --- sub DateTime::RataDie::utc_rd_values { @{$_[0]} } --- - Flavio S. Glock
Re: DateTime from Rata Die?
On Sat, 11 Oct 2003, Daisuke Maki wrote: > Bah, answering my question... > >my $rata_die = DateTime->new(year => 1, month => 1, day => 1); >my $from_rd = $rata_die + DateTime::Duration->new(days => $rd_days); That works, as does: { package DateTime::RataDie; sub utc_rd_values { @{$_[0]} } } my $dt = DateTime->from_object( object => bless [ $rd_days, 0, 0 ], 'DateTime::RataDie' ); This is admittedly a bit sneaky ;) -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: DateTime from Rata Die?
Bah, answering my question... my $rata_die = DateTime->new(year => 1, month => 1, day => 1); my $from_rd = $rata_die + DateTime::Duration->new(days => $rd_days); --d I was trying to fool around with some calculations from "Calendrical Calculations" -- one of the tables in there shows values corresponding to Rata Die dates, and I was trying to see if DateTime supported creating DateTime objects from Rata Die values... I didn't see one, so I guess it doesn't. Is this something that can be implemented? Is there a workaround? --d
DateTime from Rata Die?
I was trying to fool around with some calculations from "Calendrical Calculations" -- one of the tables in there shows values corresponding to Rata Die dates, and I was trying to see if DateTime supported creating DateTime objects from Rata Die values... I didn't see one, so I guess it doesn't. Is this something that can be implemented? Is there a workaround? --d