In our database there is a datetime
value of like 4/1/1976 12:00:00 AM
. We query this through a .NET Web-Service and display the datetime in a .NET UI.
In the UI it is displayed as "3/31/1976 11:00:00 PM".
I installed the web service locally and get a datetime like 4/1/1976 12:00:00 AM
, which tells me there is something going on at the Web-Server. Unfortunately I don't have much access to the WS, so playing around in SQL with:
CONVERT(VARCHAR(10), date, 101) AS issue_date:
UI shows 4/1/1976
CAST(CONVERT(varchar(4), DatePart(mm, date)) + '/' + CONVERT(varchar(4), DatePart(dd, date)) + '/' + CONVERT(varchar(4), DatePart(yyyy, date)) + ' 12:00:00 AM' AS DATETIME) AS issue_date:
UI shows 3/31/1976 11PM
What settings should I be looking at on the Web server that could be different than my local IIS, and per #2 above, why would forcing the time to midnight as of today not fix the UI display?
Edit:
The stored procedure is
SELECT issue_date FROM table WHERE id=1
The web service code in the webmethod is
FillDataset(connString, CommandType.StoredProcedure, spName, ds, New String() {tableName})
Return ds
Ther is of course some setup before the web service code - parms is a SqlClient.SqlParameter opbject that is loaded from XML using
parms(i) = GetSQLParm(node)