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 2005 Forums
 Express Edition and Compact Edition (2005)
 Converting date format in sqlexpress 2010

Author  Topic 

malek.safa
Starting Member

5 Posts

Posted - 2010-08-04 : 02:50:39
hello i need some help trying to change the format of my database in sqlexpress 2010 to dd/mm/yyyy, any suggestion?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-08-04 : 04:52:29
You shouldn't do that.
Formatting on date should happen when displaying or printing but never in the database/table.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

malek.safa
Starting Member

5 Posts

Posted - 2010-08-04 : 05:22:09
i have added globalization to my web.config and set it to GB so the date will appear as DD/mm/yyyy in my web page but in the DataBase it still under mm/dd/yyyy so if let's say i want to exwcute this query:
"select id from table where date = @date"
@date must be converted to mm/dd/yyyy so that it will work, i was trying to find a way to format date in sql so that i wont be converting the date each time i go to sql
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-08-04 : 05:27:34
as long as the @date variable is a datetime data type, you are good.


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

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-08-04 : 05:29:20
by the way, where did you get the sqlexpress 2010 ? The latest SQL Server version is only SQL 2008 R2


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

Go to Top of Page
   

- Advertisement -