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.
Author |
Topic |
Dan27
Starting Member
3 Posts |
Posted - 2014-09-30 : 05:27:31
|
HelloHoping someone can help. I have a date and time field in the following format dd/mm/yyyy hh:mm:ss:mmmmI only want to retrieve the date in the following format dd/mm/yyyyWhen I use the following though it retreives it in yyyy-mm-dd format.SELECT CAST(DateTime AS Date) AS 'Date'Does anyone kinow how to get this into dd/mm/yyyy format?Thanks in advance |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-09-30 : 05:31:04
|
can you try thisselect Convert(varchar(10),CONVERT(date,YourDateColumn,106),103)Javeed Ahmed |
|
|
Dan27
Starting Member
3 Posts |
Posted - 2014-09-30 : 05:36:58
|
That works great. Saves me so much time.Thanks so much |
|
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2014-09-30 : 05:37:31
|
welcome :)Javeed Ahmed |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2014-09-30 : 08:23:11
|
The format matters only if you want to display it. If you use front end application do this format thereMadhivananFailing to plan is Planning to fail |
|
|
|
|
|