• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1274
  • Last Modified:

SQL - Convert month name or month number to datetime

Is there a way to convert a month name or month number to datetime in SQL?

Ex:
   Convert 'November' to '2010-11-01 00:00:00.000'       or
   Convert '11' to '2010-11-01 00:00:00.000'
0
Rick
Asked:
Rick
  • 2
1 Solution
 
RickAuthor Commented:
... or Convert 'NOV' to '2010-11-01 00:00:00.000'  
0
 
ralmadaCommented:
just add the remaining part and convert to datetime
convert(datetime, '2010-' + 'NOV' + '-01')
0
 
RickAuthor Commented:
Simple as that!

Thank you, ralmada.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now