Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL - Convert month name or month number to datetime

Posted on 2010-09-09
3
Medium Priority
?
1,261 Views
Last Modified: 2012-05-10
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
Comment
Question by:Rick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Author Comment

by:Rick
ID: 33637920
... or Convert 'NOV' to '2010-11-01 00:00:00.000'  
0
 
LVL 41

Accepted Solution

by:
ralmada earned 2000 total points
ID: 33637959
just add the remaining part and convert to datetime
convert(datetime, '2010-' + 'NOV' + '-01')
0
 
LVL 13

Author Closing Comment

by:Rick
ID: 33638003
Simple as that!

Thank you, ralmada.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question