Various strings to dates.
amy-g-art at cox.net
Fri Jan 23 23:02:27 CET 2004
No it won't. Unfortunatly I don't necessarily have a comma delimited date
string. Thanks for the input though.
The following three date strings is another example of the various date
formats I will encounter here.
Thursday, 22 January 2004 03:15:06
Thursday, January 22, 2004, 03:15:06
2004, Thursday, 22 January 03:15:06
All of these are essentially the same date... just in various formats. I
would like to parse through them and get a comparable format so that I can
display them in chronological order.
"wes weston" <wweston at att.net> wrote in message
news:MFgQb.95539$6y6.1915432 at bgtnsc05-news.ops.worldnet.att.net...
> I hope there is a better way but, if you go here:
> The new datetime module may help. This and the time mod
> should get you where you want to go.
> list = strdate.split(", ")
> daystr = list
> daynum = int(list)
> monthstr = list
> year = int(list)
> #funct to get a month int is needed
> d = datetime.Date(y,m,d)
> Amy G wrote:
> > I have seen something about this beofore on this forum, but my google
> > didn't come up with the answer I am looking for.
> > I have a list of tuples. Each tuple is in the following format:
> > ("data", "moredata", "evenmoredata", "date string")
> > The date string is my concern. This is the date stamp from an email.
> > The problem is that I have a whole bunch of variations when it comes to
> > format that the date string is in. For example I could have the
> > two tuples:
> > ("data", "moredata", "evenmoredata", "Fri, 23 Jan 2004 00:06:15")
> > ("data", "moredata", "evenmoredata", "Thursday, 22 January 2004
> > I know there is some way to use the date string from each of these to
> > date usable by python, but I cannot figure it out.
> > I was trying to use time.strptime but have been unsuccesful thus far.
> > Any help is appreciated.
More information about the Python-list