Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 getting date format in Sql

Author  Topic 

archana23
Yak Posting Veteran

89 Posts

Posted - 2013-12-18 : 19:40:39
Hi,

I am pulling data from table which has date field to it.

I am using below query to get the date

select ArrivalDate As[ARRIVE DATE, , Date, 0], ArrivalTime As[ARRIVE TIME, 4, String, 0] from ArrivalInfo

but i am getting date as 20130925 in format but i want date to be in 09/25/2013 (mm/dd/yyyy)..

Can anyone please help me on this..

Thanks.





Archana

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-12-18 : 21:56:36
[code]SELECT CONVERT(VARCHAR(10), ArrivalDate , 101) As[ARRIVE DATE, , Date, 0][/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-19 : 03:25:35
This is purely a presentation requirement and is recommended to do at your front end language. Doing this in SQL requires unnecessary conversions to varchar type and will cause issues if these values are used for further manipulations like sorting, comparison etc.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -