Solved

CHANGING A DATE FORMAT IN T-SQL

Posted on 2010-11-29
6
196 Views
Last Modified: 2012-05-10
Hi,

i'VE A DATE  IN  YYYY-MM-DD HH:MM:SS:FF and I need to convert it to dd-mon-yyyy

so for example I need to change  2010-11-05 00:00:00.000 to 05-Nov-2010.

Any help would be much appreciated.

l.

0
Comment
Question by:LINNANDA
6 Comments
 
LVL 28

Accepted Solution

by:
sammySeltzer earned 500 total points
ID: 34231910
Try this:

SELECT REPLACE(CONVERT(VARCHAR,yourDate ,106),' ','-')

FROM yourTable

Open in new window

0
 
LVL 51

Expert Comment

by:HainKurt
ID: 34231988
"DATE  IN  YYYY-MM-DD HH:MM:SS:FF"

firs of all date column does not have any format ;) if you have a date column and you want to display it in "dd-mon-yyyy" use

replace(convert(varchar, datetime_column, 106),' ', '-')
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 34231999
oops, same as sammy's solution ;) ignore my post
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 7

Expert Comment

by:rmm2001
ID: 34233180
convert(smalldatetime, yourdate)
0
 

Author Closing Comment

by:LINNANDA
ID: 34238632
Thanks Sammy that worked fine.
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 34241655
You're very welcome.

Thanks for the points/grade.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now