Re: Are the formats in DateTime::Format::Strptime extensible?

[email protected] (Nathan Gray)
Newsgroups perl.datetime
Message-ID <[email protected]>
On Thu, Mar 15, 2012 at 04:43:32PM -0500, David McMath wrote:
> A while back, I needed to some routines to parse timestamps so I
> started using DateTime::Format::Strptime.  The times were uniformly
> formatted like "2012-03-13T07:43:07-07:00".  That /almost/ matched
> the pattern "%FT%T%z" but I couldn't figure out how to force the
> match.  So I ended up taking a shortcut and removing the final ":"
> before processing.
> 
> Now I want to recycle the code and handle a few more formats and I'd
> /really/ like it to be the case that I don't have to do any
> manipulations of the strings before parsing; I'd much rather just
> have the caller specify what the proper format is and go from there.

You might take a look at DateTime::Format::Builder.

-kolibrie
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk9injsACgkQYlZScpXqKgS2+gCePS46UfA44AqndDOCycSAoof5
4aMAniR+Uzbf4k1Zf976+phTAqGGWD48
=9wuZ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.