Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date/Time problems...

Status
Not open for further replies.

Jetter88

Programmer
Nov 14, 2003
35
CA
We're having a problem with the day and month being switched when trying to save a date value to a SQL Server 2000 database, from an ASP page. The date has a time attached to it.

In our ASP page, we are attaching the date to an ADO parameter as follows:

cmdTC.Parameters.Append cmdTC.CreateParameter("@dtDateReceivedIN",adDate,adParamInput,,dtDateTimeReceived)

The stored procedure accepts the parameter as "DateTime".

When I run the code locally from IIS on my machine, passing in a date of July 6, 2006, the date is properly stored. But when I deploy the code to IIS on the web server and run the code from there, it saves the date in the database as June 7 instead of July 6, so it's getting confused about which is the day and which is the month.
 
in the US we do Month/Day/Year but the brits do Day/Month/Year so maybe your server is confused about its location?
 
Please read this thread for more information regarding Date issues (as they relate to SQL Server). thread183-1240616

Bottom line, you're better off using the ISO date format: yyyymmdd

So 20060706 is july 6th
and 20060607 in june 7.



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top