0

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)
Rod C
  • 56
  • 9
  • I think if your web-service uses UTC internally, converting to/from a local time-zone only in the UI. – Krishnraj Rana Jan 28 '14 at 20:32
  • I'll look into the UTC bit. The code in the web-service only does a read (fill) and returns the dataset. – Rod C Jan 28 '14 at 20:50
  • I don't see anthing that would be converting to or from UTC. All servers/clients are using CST. – Rod C Jan 28 '14 at 22:07
  • @Krishnraj, I also looked at the IIS logs. The timestamp of the first entry is 00:00:29. I think that means that the timezone used is the timezone of the server. Is that correct? – Rod C Jan 29 '14 at 14:25
  • Could you post your Stored procedure or web service code ?? – Krishnraj Rana Jan 29 '14 at 18:20
  • @Krishnraj, edit is done. As you can see it is very simple code. – Rod C Jan 29 '14 at 19:01

0 Answers0