View Full Version : dates and SQL Server

02-04-2003, 05:00 PM
I am trying to enter dates into a MSSQL server 2000 db. Everytime it updates it saves the value 1/1/1900. If I Response.Write my SQL it is showing the correct dates. For some reason when it is updating though it is changing it to 1/1/1900. I have tried just entering the date like txtdtExpires.Text and casting its type to a date CType(txtdtExpires.Text,Date) with no luck. Can anyone tell me why it enters 1/1/1900?

02-04-2003, 10:07 PM
the best format for keeping dates is

2003-01-14 = YYYY-MM-DD

I think you are hosting your web site in another culture as yours,

you must save the date in the universal format as above, and then display the result on your web page with the culture you like

if you cannot do it, then just save your dates as string

02-04-2003, 10:36 PM
Can you post the SQL statement as it's written out?

02-05-2003, 04:23 AM
Finally figure it out I did need to CType(var,Date) but I forgot to put the infamous ' ' around them.:rolleyes: