Buddhist era dates
Hi folks, Does anyone know of a way to get strftime (or DateTime) to return the appropriate format for years, regardless whether the locale is in Common Era or Buddhist Era? I am able to get the current year B.E. like this: $ LC_ALL=th_TH perl -MPOSIX=strftime -le 'print strftime(%Ey,localtime)' 2548 However, if I try to use the %Ey format in a CE locale, I don't get the 2005 I expected, but 05 instead: $ LC_ALL=en_US perl -MPOSIX=strftime -le 'print strftime(%Ey,localtime)' 05 TIA, Philip
Handling arbitrary time zone information (such as stored in an iCalendar file)
I need to read in some iCalendar files. I would like to read in the data and dates encoded according to the arbitrary time zone information in the iCalendar files and then be able to reinterpret the dates according to the regular DateTime::TimeZone modules. I can either do this the quick and dirty way (which is probably where I'll start anyway) and just read the dates in and do a quick conversion to UTC using the time zone information in the iCalendar file. Once read in, I can then convert the time zones via DateTime::TimeZone modules as needed. The main reason for my mail is to see if there would be any interest in a module that implements the DateTime::TimeZone information via the arbitrary/incomplete time zone information, like that which is stored in an iCalendar format (or any general source, it wouldn't need to be specific to iCalendar). This module would be similar DateTime::TimeZone::OffsetOnly, but would contain an arbitrary set of DateTime spans, which would then have offsets associated with them---also somewhat similar to the way the individual DateTime::TimeZone::* classes are built internally, but configurable per-instance. Does such a thing already exist and I'm not finding it? Is there interest in such a thing? I'd write it, but I'm not quite sure what to call it? DateTime::TimeZone::Arbitrary? DateTime::TimeZone::OffsetSpans? Suggestions? Cheers, Sterling
Re: Handling arbitrary time zone information (such as stored in an iCalendar file)
On 12/20/05, Andrew Sterling Hanenkamp [EMAIL PROTECTED] wrote: The main reason for my mail is to see if there would be any interest in a module that implements the DateTime::TimeZone information via the arbitrary/incomplete time zone information, like that which is stored in an iCalendar format (or any general source, it wouldn't need to be specific to iCalendar). I can't comment in the impl questions, but can say that we're going to need to integrate iCal stuff (and related calendar microformats..) into a strict DateTime envir, so this sounds very intriguing. -- == 2People Blog: http://2-people.blogspot.com/ 2People site: http://www.2people.org
Re: Date range from Week number
Dave Rolsky wrote: This seems like something that'd be a nice add-on constructor for DateTime.pm. Maybe we need some DateTime::Constructor::* modules or something, because I sure don't want dozens of constructors in the core code. We *are* missing a namespace but I'm not sure that it's ::Constructor:: .. this problem seems similar to the GPS one. I started playing with that the other day, and couldn't work out where if fit: 1. ::Format:: These modules are for inputting datetimes in a string format and retrieving them in the same format. The GPS format is just a different way of representing dates (in weeks and seconds since a given epoch) 2. ::Calendar:: These are for non-Gregorian datetimes. GPS is gregorian. 3. ::Event:: A gps datetime isn't an event So now I come back to DateTime::Decorated that I started back in June to deafening silence... Unless I get any objections I'll get it ready to go, and release GPS and WeekConstructor at the same time. my $DateTimeGPS = DateTime::Decorated( with = 'GPS' ); my $dt = $DateTimeGPS-from_gps( week = 87, second = 23456 ); # Internally, this is a standard DateTime, but the decorator has # given us a new constructor. Likewise, we now have extra accessors: print $dt-gps_week; # 87 print $dt-gps_second; # 23456 # and a couple of setters: $dt-set_gps_week( 88 ); $dt-set_gps_second( 0 ); SIMILARLY: my $DateTimeWeek = DateTime::Decorated( with = 'WeekConstructor' ); my $dt = $DateTimeWeek-from_week( year = 2005, week = 48 ); AND COMBINING TOO my $DateTime2 = DateTime::Decorated(with = ['GPS', 'WeekConstructor']); my $dt = $DateTime2-from_week( year = 2005, week = 48 ); print join('G', $dt-gps_week, $dt-gps_second); __END__ Cheers! Rick Measham -- War is God's way of teaching Americans geography. -- Ambrose Bierce