Monday, March 19, 2012

DateTime Issue

How do I exclude showing the seconds out of a datetime column?
I tried converting it to smalldatetime but it only rounds it up to "00".

e.g.

2004-01-03 16:33:20

I want to show only:
2004-01-03 16:33

I know this can be achive by using Datepart function calling each
part of the datetime, but is there a simplier way?

Basically the datetime value will be shown to a ASP page. And I don' t want to show until seconds.Have you tried to cast/convert it to a varchar ?|||ooh...thanks...,
err...what if I want it to remain showing numbers instead of the date names?
Cast/convert will change the datetime column into date names
e.g. JAN,FEB...etc....|||Like ...

convert(varchar(16),datecol,121)|||Thanks..that was a fast response.|||When you need to change the format of the date - look in bol under "Cast and Convert", it will show you the formats that enigma references.

No comments:

Post a Comment