Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date Format with Select Statement

Status
Not open for further replies.

gavjb

Technical User
Jul 5, 2005
67
GB
Hi,

When using the Convert to format the Date in a select statement I dot seem to have any change in the display, can someone tell me if I am doing something wrong.

If I use convert(datetime, '31-dec-2010', 3) or convert(datetime, '31-dec-2010', 103) all I get for the results is

2010-12-31 00:00:00.000

Thanks,


Gavin,
 
The purpose of the third parameter is to determine the display format, so you need to convert to varchar not to datetime.


Hope this helps.

[vampire][bat]
 
You are converting a datetime to a datetime.
If you want to format it for display convert it to a varchar.

i.e.
convert(varchar(21), '31-dec-2010', 101)

"I'm living so far beyond my income that we may almost be said to be living apart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top