Solved

SQL - Convert month name or month number to datetime

Posted on 2010-09-09
3
1,248 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 500 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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 extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

710 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