[Dateutil] Retrieving format string from parsed string

Paul G paul at ganssle.io
Tue Jan 24 18:21:23 EST 2017


Unfortunately it is not at this time:

https://github.com/dateutil/dateutil/issues/125

This improvement is part of a more general improvement to the parser that I'd like to work on soon. It's a bit trickier than just outputting something that can be parsed by strptime, because dateutil's parser can infer dates in formats that are not compatible with strptime (mostly to do with time zones).

On 01/24/2017 04:45 PM, Bart Baker wrote:
> Hello,
> 
> I was wondering if it is possible to retrieve the inferred format string
> from a parsed date str. For example, if I parse a str as follows:
> 
> import dateutil
> mystr = '1990/04/22'
> parsed = dateutil.parser.parse(mystr)
> 
> Is there any way to retrieve 'YYYY/MM/DD'? I'm assuming the returned
> datetime object doesn't retain the information.
> 
> I would appreciate any help that you could offer.
> 
> Thank you,
> Bart
> _______________________________________________
> Dateutil mailing list
> Dateutil at python.org
> https://mail.python.org/mailman/listinfo/dateutil
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/dateutil/attachments/20170124/9eb915fd/attachment.sig>


More information about the Dateutil mailing list