General discussion

Locked

Displaying Date

By jamiep ·
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 ?

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Displaying Date

by nikki96 In reply to Displaying Date

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

Collapse -

Displaying Date

by jamiep In reply to Displaying Date

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

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

Collapse -

Displaying Date

by jamiep In reply to Displaying Date

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums