Re: DateTime::Duration::W3C?

2009-07-05 Thread Paul Hoffman
On Fri, Jul 03, 2009 at 06:40:30AM -0700, Ovid wrote:

 If this is on the CPAN, please let me know. I can't find it. If not,
 we probably need it at work.
 
 The W3C duration standard
 (http://www.w3.org/TR/xmlschema-2/#duration), derived from the ISO
 8601 duration standard, allows one to specify durations in a format
 like PnYnMnDTnHnMnS (e.g.: P1Y2MT2H, a duration of one year, two
 months and two hours).  I can't find a proper parser for it and it
 turns out to have some tricky bits.  Basically, I want to do this:
 
   my $duration = DateTime::Duration::W3C-new(P1Y2MT2H);
 
 Which would be more or less equivalent to:
 
   my $duration = DateTime::Duration-new(
   years  = 1,
   months = 2,
   hours  = 2,
   );
 
 I can write this and try to handle the special cases I find documented
 (I'll be damned if I'm going to pay 130 Swiss Francs for the damned
 ISO 8601 standard), but I'd love to know if it's already out there.

You can download ISO 8601 (3rd ed.) at this URL:

http://isotc.iso.org/livelink/livelink/4021199/ISO_8601_2004_E.zip?func=doc.Fetchnodeid=4021199

 Cheers,
 Ovid

Paul.

-- 
Paul Hoffman nkui...@nkuitse.com


Re: DateTime::Duration::W3C?

2009-07-05 Thread Ovid

- Original Message 

 From: Paul Hoffman nkui...@nkuitse.com
 
 You can download ISO 8601 (3rd ed.) at this URL:
 
 http://isotc.iso.org/livelink/livelink/4021199/ISO_8601_2004_E.zip?func=doc.Fetchnodeid=4021199

Thanks Paul!

Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog- http://use.perl.org/~Ovid/journal/
Twitter  - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6