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
 Chanign the default date format

Author  Topic 

KostaK
Starting Member

16 Posts

Posted - 2009-11-28 : 09:00:54
Apparently people have been telling me I can't post MySQL questions that relate to commands entered into the Command Prompt as it's not really SQL Server. But if you tell me a big forum that I can go to to ask these questions I will leave.

The question I have though is there any way to change the default date format?

When I create a table with a column named Subscribed for example, how do I make it so I can enter dates as 02-08-2008 for example (DD-MM-YYYY) instead of the standard YYYY-MM-DD?

Thank you

I am learning SQL.

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-11-28 : 12:01:57
A good all-purpose forum is www.dbforums.com As to the date question. Don't worry how the way SQL Server dates look. It doesn't actually store mm-dd-yyyy or yyyy-mm-dd. It actually stores an integer that represents how may days from '01/01/1900'. You can use SET Dateformat dmy in sql serverfor data entry.

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-28 : 13:44:06
and at front end you can use your date formatting functions to get date in form you wanted
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2009-11-28 : 14:07:32
try http://www.sitepoint.com/forums/forumdisplay.php?f=182
Go to Top of Page

KostaK
Starting Member

16 Posts

Posted - 2009-11-28 : 19:17:30
Thanks guys, well I guess it's the last for me here.
Enjoy SQL Server, I will use my command line prompt with happyness.

I am learning SQL.
Go to Top of Page

behrman
Yak Posting Veteran

76 Posts

Posted - 2009-11-28 : 22:19:42
SELECT CONVERT(VARCHAR(10), GETDATE(), 105) AS [DD-MM-YYYY]

RAQ Report: Web-based Excel-like Java reporting tool
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-29 : 12:36:56
quote:
Originally posted by behrman

SELECT CONVERT(VARCHAR(10), GETDATE(), 105) AS [DD-MM-YYYY]

RAQ Report: Web-based Excel-like Java reporting tool


i dont prefer doing this conversion just for formatting purpose in t-sql
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-30 : 01:46:24
quote:
Originally posted by behrman

SELECT CONVERT(VARCHAR(10), GETDATE(), 105) AS [DD-MM-YYYY]

RAQ Report: Web-based Excel-like Java reporting tool


This wont work in mysql

Madhivanan

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

- Advertisement -