Discussion Locked

Displaying Date

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hello,
I have a date in a SQL server table that is like :
dd/mm/yyyy/hh:mm:ss, how can I convert it and display it like dd/mm/yyyy ?

3 replies

by nikki96

AFAIK, you can't from a straight SQL query in SQLServer.
If you are familiar with procedures in SQLServer, you can look at these examples. They are custom procedures to format a date.
http://www.lewismoten.com/Items/Document/View.asp?ItemID=520
http://www.swynk.com/sqlscripts/misc7.asp
(remove spaces from above URLs, if any)

If you are using another language to get at the data, like C, C++, VB, ColdFusion, PHP, Java, or Unix Shell, you can select the date from the database and format it using that language's functions.

HTH
Nikki

by jamiep

I have foiund out you can use the following to convert long date to short :

CONVERT(VARCHAR(25), InsertDate, 101) AS inserted

This discussion is closed to new replies.