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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 smalldatetime format question

Author  Topic 

kensai
Posting Yak Master

172 Posts

Posted - 2003-06-10 : 15:20:57
Hi. I'm using SQL Server for some Turkish site. In Turkish culture we use DD/MM/YYYY format for date. The comp used for SQL Server is configured for Turkish language, also the collation of the database is Turkish_CI_AS. The problem is, SQL Server still uses MM/DD/YYYY format on smalldatetime fields. What should I do to make it use DD/MM/YYYY format?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-06-10 : 15:23:34
The data isn't stored in MM/DD/YYYY format, it's just that it defaults to that display. To display it in another way, use CONVERT with the appropriate style. CONVERT is described in SQL Server Books Online.

Tara
Go to Top of Page

kensai
Posting Yak Master

172 Posts

Posted - 2003-06-10 : 15:34:13
Thanks for the reply tduggan.

I'm sorry I forgot to say that I'll use the SQL Server for my ASP.NET pages. When I use DateTime.Now.ToShortDateString() the ASP.NET page displays properly, like "13.06.2003". I can't insert this value to the table. Yes, I can take Now.Day, Now.Month and Now.Year values and construct the appropriate format to insert the table but I don't want this. Is there a better way?

Edited by - kensai on 06/10/2003 15:38:06
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-06-10 : 15:50:21
Why don't you pass the date into a stored procedure while will do the insert and the stored procedures converts the date before the insert? Stored procedures are preferred for security reasons and performance reasons.

Tara
Go to Top of Page
   

- Advertisement -