Can anyone advise on the best way to format the following date string format…
Sat, Sep 22
to something that I can store in SQL Server as a date/time…
using format such as YYYY/MM/DD
I could do this in code, but I am reading hundreds of xml extracts not sure how best to approach this.
You could use
DateTime.Parse()See here for info. Although, you’ll have to have a year in there somewhere.EDIT:
Since we’re not sure if you know what year you are dealing with, I suggest that you might use something like this:
This will get the DateTime for the most recent year that fits the description. If you try to use an
aDateof “Fri, Sep 22”, then your result will be “9/22/2006”.Or, if you just want to use ‘this year’ you could just use this: