Last post Jun 08, 2013 04:50 PM by sukumarraju
Mar 08, 2013 03:12 AM|babu17|LINK
I have a C# webservice(server) and C# windows form(client). My webservice method accepts a dataset object as parameter. The dataset has 2-3 datatables, and in the tables there are datetime columns.
The client is installed in different locations, when the dataset is sent from a client the datetime columns are modified by adding/subtracting the datetime offset values, because of this the webserver is receiving the wrong dates.
I am not in a position to change anything on the client, how can I handle the issue on the server side (in web service).
All I want is that the date fields should be transferred exactly as entered at client(like string data type).
I am using access database as backend for windows forms client. When exporting the data from client, the client creates a dataset(2-3 tables) and passes the dataset to webservice method. I debugged the client and I think it is during the serialization, the
datetime offset is added to datetime columns. I want to remove offset during de-serialization.
example: if at client the date is 01/01/2011, the server is receiveing it as 31/12/2010.
Jun 08, 2013 03:34 AM|Ravitheja Bandi|LINK
Specify the cultural information before you use date time in programming.
Jun 08, 2013 04:50 PM|sukumarraju|LINK
client is installed in different locations,
Use SpecifyKind method as shown below.
A DateTime object consists of a Kind field that indicates whether the time value is based on local time, Coordinated Universal Time (UTC), or neither,
and a Ticks field that contains a time value measured in 100-nanosecond ticks. The SpecifyKind method creates a new DateTime object
using the specified kind parameter and the original time value. [source: http://msdn.microsoft.com/en-us/library/system.datetime.specifykind.aspx ]