Groups | Blog | Home
all groups > sql server (alternate) > october 2004 >

sql server (alternate) : Problem with date


Simon Hayes
10/14/2004 3:10:34 PM

[quoted text, click to view]

See CONVERT() in Books Online:

select convert(char(10), getdate(), 103)

Or you can format dates in the client application - it can be easier to
provide the correct regional formatting for different clients that way. You
might not need to be able to do that in your situation, of course.

Simon

Federica T
10/14/2004 3:12:09 PM
Is there a shorter (an easier) way to obtain a date in this format
'14/10/2004', instead of writing the following query?

select rtrim(ltrim(cast(DATEPART(m, GETDATE()) as char)))+ '/'+
rtrim(ltrim(cast(DATEPART(d, GETDATE()) as char))) + '/' +
rtrim(ltrim(cast(DATEPART(yy, GETDATE()) as char)))
as dato from dummy

Thank you!
Federica

Federica T
10/14/2004 3:21:16 PM
[quoted text, click to view]
Thank you, Simon!

AddThis Social Bookmark Button