Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Formatting Date Value

Author  Topic 

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2010-06-16 : 11:11:31
Hi

I have a date value in SQL table as below:

1999-11-03 00:00:00.000

That I would like to return as this format:

dd-mm-yyyy 00:00

Can you tell me how to do this?

Thanks for any advice,

G

X002548
Not Just a Number

15586 Posts

Posted - 2010-06-16 : 11:43:00
know what books on line is?

Look up CONVERT

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2010-06-16 : 11:54:46
Yes I had tried CONVERT but couldn't seem to get it to the format I was wanting.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-06-16 : 11:59:44
Do a little concatenation:
DECLARE @myDate datetime
SET @myDate='19991103'
SELECT CONVERT(char(10), @myDate, 105) + ' ' + CONVERT(char(5), @myDate, 8)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-17 : 03:17:15
quote:
Originally posted by Grifter

Hi

I have a date value in SQL table as below:

1999-11-03 00:00:00.000

That I would like to return as this format:

dd-mm-yyyy 00:00

Can you tell me how to do this?

Thanks for any advice,

G


Where do you want to show formatted dates?
If you use front end application, do formation there


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -