Re: parse date string having "EDT"

2011-06-22 Thread Tim Roberts
Ben Finney wrote: >Tim Roberts writes: > >> Right, because strptime doesn't support %Z. > >Au contraire: > >Support for the %Z directive is based on the values contained in >tzname and whether daylight is true. Because of this, it is >platform-specific except for recognizing UTC and

Re: parse date string having "EDT"

2011-06-21 Thread Miki Tebeka
You might consider trying dateutil.parser.parse (http://labix.org/python-dateutil#head-c0e81a473b647dfa787dc11e8c69557ec2c3ecd2) -- http://mail.python.org/mailman/listinfo/python-list

Re: parse date string having "EDT"

2011-06-21 Thread Junaid P V
Thanks, My script should be platform independent, so I think filtering out time zone info is better. -- http://mail.python.org/mailman/listinfo/python-list

Re: parse date string having "EDT"

2011-06-20 Thread Ben Finney
Tim Roberts writes: > Right, because strptime doesn't support %Z. Au contraire: Support for the %Z directive is based on the values contained in tzname and whether daylight is true. Because of this, it is platform-specific except for recognizing UTC and GMT which are always know

Re: parse date string having "EDT"

2011-06-20 Thread Tim Roberts
Junaid P V wrote: > >I was trying to parse a date string containing "EDT" time zone > >eg: 'Mon Jun 20 14:00:57 EDT 2011' > >I tried: > >datetime.strptime('Mon Jun 20 14:00:57 EDT 2011', '%a %b %d %H:%M:%S %Z %Y') > >But I get error Right, because strptime doesn't support %Z. You'll have to hand

Re: parse date string having "EDT"

2011-06-20 Thread Ben Finney
Junaid P V writes: > I tried: > > datetime.strptime('Mon Jun 20 14:00:57 EDT 2011', '%a %b %d %H:%M:%S %Z %Y') > > But I get error When reporting that you get an error, please give the full error and traceback. My mind reading skills are telling me, though, that you're getting a ValueError bec

parse date string having "EDT"

2011-06-20 Thread Junaid P V
I was trying to parse a date string containing "EDT" time zone eg: 'Mon Jun 20 14:00:57 EDT 2011' I tried: datetime.strptime('Mon Jun 20 14:00:57 EDT 2011', '%a %b %d %H:%M:%S %Z %Y') But I get error -- http://mail.python.org/mailman/listinfo/python-list

Re: parse date/time from a log entry with only strftime (and no regexen)

2010-11-11 Thread Simon Mullis
This was a long time ago But just in case anyone googling ever has the same question, this is what I did (last year). The user just needs to supply a strftime formatted string, such as "%A, %e %b %h:%M" and this Class figures out the regex to use on the log entries... class RegexBuilder(object

Re: parse date/time from a log entry with only strftime (and no regexen)

2009-02-05 Thread Simon Mullis
That, my friend, is ingenious...! Thankyou SM 2009/2/3 andrew cooke > > > ValueError: unconverted data remains: this is the remainder of the log > > > > line > > > that I do not care about > > you could catch the ValueError and split at the ':' in the .args > attribute to find the extra data.

Re: parse date/time from a log entry with only strftime (and no regexen)

2009-02-03 Thread andrew cooke
> > ValueError: unconverted data remains:  this is the remainder of the log   > > line > > that I do not care about you could catch the ValueError and split at the ':' in the .args attribute to find the extra data. you could then find the extra data in the original string, use the index to remove

Re: parse date/time from a log entry with only strftime (and no regexen)

2009-02-03 Thread Gabriel Genellina
En Tue, 03 Feb 2009 11:52:07 -0200, Simon Mullis escribió: I'm writing a script to help with analyzing log files timestamps and have a very specific question on which I'm momentarily stumped I'd like the script to support multiple log file types, so allow a strftime format to be pas

Re: parse date/time from a log entry with only strftime (and no regexen)

2009-02-03 Thread MRAB
Simon Mullis wrote: > Hi All > > I'm writing a script to help with analyzing log files timestamps and > have a very specific question on which I'm momentarily stumped > > I'd like the script to support multiple log file types, so allow a > strftime format to be passed in as a cli switch (defau

parse date/time from a log entry with only strftime (and no regexen)

2009-02-03 Thread Simon Mullis
Hi All I'm writing a script to help with analyzing log files timestamps and have a very specific question on which I'm momentarily stumped I'd like the script to support multiple log file types, so allow a strftime format to be passed in as a cli switch (default is %Y-%m-%d %H:%M:%S). When i

Parse date

2006-01-12 Thread Jacob Friis Saxberg
Hi.How do I parse a date like "2006-01-12T09:05:08+02:00"?I'd like to parse it into the local time for my server.Thanks.Jacob -- http://mail.python.org/mailman/listinfo/python-list