convert MONDAY, SEPTEMBER 21, 1942 to Datetime

I have a data file I am trying to convert into either a SQL Server or  Postgres database.  How can I convert the following date field value into a string compatible with either a Postgres or SQL Server date field?

MONDAY, SEPTEMBER 21, 1942

I will give points for either a way in Postgres or SQL Server.  Preferrably in T-SQL or pl/pg SQL
FreightTrainAsked:
Who is Participating?
 
furrybootsistheanswerConnect With a Mentor Commented:
Is your date as string currently? If so, you can use charindex and substring to remove the leading 'DAYNAME, '  and then simply convert to datetime. In SQL server:

select convert(datetime,substring('MONDAY, SEPTEMBER 21, 1942',(charindex(',','MONDAY, SEPTEMBER 21, 1942') +2), (len('MONDAY, SEPTEMBER 21, 1942') -1)),101)

0
 
FreightTrainAuthor Commented:
Yes, it is a string!  AWESOME!  Thank You!!!  
0
All Courses

From novice to tech pro — start learning today.