Hello people.
Please, is there any way to change the date format of a smalldatetime column of a table in SQL Server Express?
What I mean is that the default date format for a column which type is smalldatetime is "MM/dd/yyyy" but I'm developing a localized application and the date format that I would like to use is "dd/MM/yyyy", so I would like to know is if there any way to change this.
I know that I could write some code in my application in order to do the conversion, but I would like to avoid this because I'm using the databinding property of the control and if I have to write a piece of code in order to do the conversion, I will loose this functionality.
I'm currently using WindowsXP SP2, SQL Server Express 2005, SQL Server Management Studio Express and VB.Net 2005 Express Edition. All applications including the OS are USA English version. The application that I'm writing is being localized to PT-BR (Brazilian Portuguese).
Any help and suggestions are very welcomed.
Thanks a lot for all your time and attention.
Rodrigo.
Hi,
SQL Server just stores a generic format , it is displayed on a user based setting. The formatting should be always done at the client side, just make sure that you have an appropiate machanism for formatting in place and that you application can handle the datetime type coming from SQL Server.
"Datetime values are stored internally by SQL Server as two four-byte integers, where the first four bytes store the number of days before or after the base date, January 1, 1900, and the other four bytes store the time of day represented as the number of milliseconds after midnight. Datetime stores date and time data from January 1, 1753, through December 31, 9999, to an accuracy of 1/300th of a second (equivalent to 3.33 milliseconds, or 0.00333 seconds), and values are rounded to increments of .000, .003, or .007 seconds." http://msdn2.microsoft.com/en-us/library/aa175784(SQL.80).aspx
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||Tanks a lot for your answer Jens.
It solved my problem. I was making a mistake because I was handling that data that came from SQL Server as a string. Everything is working ok now that I'm using the data as a numeric value.
Cheers,
Rodrigo.
No comments:
Post a Comment