Thursday, March 8, 2012

DateTime Datatype, How to display just Date, not time

I have a column with DateTime Datatype. But I want to display just Date , not time.

Like 4/26/2006 not 4/26/2006 9:25:55AM

pls help

check out the CONVERT and CAST functions. Try the following. If you check out books on line for the CONVERT functions they have a list of values and the formats the function will produce with the value. Here's an example:

SELECT CONVERT(varchar, getdate(), 101)

|||

Format it before output.

Cdate("10/1/2006 11:00:00").Tostring("d")

or if you are using it, and databinding it to a grid, textbox, etc, specify a format of "d".

No comments:

Post a Comment