I am fairly new to SQL programming, and have a problem with dates.
In my SQL text in vb.net i have this set to eg "04/09/06 00.00.01" executing that
sql command works fine, but when i go to read the data back its shows as
09/04/06. If the dates is something like 25/09/06 it fails because i assume SQL
read this as day 9 of month 25!.
I have UK dates in control panel, how can i ensure SQL supports UK style dates
The field type is datetime, i am using the executenonquery command after setting the commandtext to the sql syntax.
Many Thanks for your help in advance
Chris Anderson
First of all, for storage reasons, SQL Server doesn′t matter which language the user is using. The appropiate display format is determined when the user is querying the data. But SQL Server will only pass back the date (if not other queried) as a native datetime leaving it to the client to change back the date a the user needs it. How do you store the date ? Is it a datetime or a string ? If its a datetime it is not stored as the 25th month of the year, because would have led to a onversion error at insert time notbeing in the valid range for datetimes. You mighthave a deeper look ino the format of your textbox in the frontend.HTH; Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||
Many thanks for your reply. It is a datetime variable but i have solved the problem having seen another post.
I use the YYYYMMDD 00:00:00 format, and have a function to convert my date into this format before i shoot it off to SQL Server.
Worked perfectly.
Thanks again
sql
No comments:
Post a Comment