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
 formating date to be DD/MM/YYYY

Author  Topic 

WebCrab
Starting Member

8 Posts

Posted - 2009-08-05 : 12:18:22
Hello, i'm using sql server management studdio express and i have a column named "Date" with the datatype "datetime" the problem is when i fill it i keep getting the time in addition to the date. how do i format as the aforementioned?
10x.

Click! Click!

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-08-05 : 12:27:38
as the datatype implies the time will be included as part of the value. Where are you "presenting" this date? typically some front end application will have formattable controls to display datetimes in a wide variety of formats. That is where you should format it. If you want it to display in a query window with a specific format you can select the value with a CONVERT function applied to it but then it will no longer be a date but rather a string. See CONVERT in books online. ie: select convert(varchar(10), [date], 101)

Be One with the Optimizer
TG
Go to Top of Page

WebCrab
Starting Member

8 Posts

Posted - 2009-08-05 : 13:12:02
the data is displayed in a repeater in an asp.net page.
the repeater produces results according to an sql command which it's string ends with "ORDER BY Date DESC".


Click! Click!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-08-06 : 02:32:29
When you represent data in asp.net page, make use of format function

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -