<Si******@gmail.comwrote in message
news:09**********************************@26g2000h sk.googlegroups.com...
Hi,
I got a client application where it calls the webservices to save and
retreive dates from an Oracle database. 1 problem I've encountered is
that when a user select a certain date in the client application, when
this date got to the webservice, it got offset by 1 day (plus/minus 1
day depending on where is the user).
Is there any easy solution where the date appears and saved as it is?
i.e. user select 2nd July 2008, and the webservice gets and saves 2nd
July 2008 without doing any region offset.
Where are the users located? In the same time zone as the server or a
different one?
You should create yourself a simple example to reproduce this and narrow it
down. For instance, it's possible the problem has nothing to do with Oracle,
so your reproducer should not include Oracle or any other database. Just
write a client that sends a known date and time to a service. Here's an
example. Service:
using System;
using System.Globalization;
using System.Web.Services;
namespace TimezoneServer
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class Service1 : WebService
{
[WebMethod]
public string DisplayTimeAndDate(DateTime justDate, DateTime
dateAndTime)
{
return String.Format(
CultureInfo.InvariantCulture,
"justDate={0}|dateAndTime={1}", justDate, dateAndTime);
}
}
}
Client:
using System;
using TimezoneClient.TimezoneServiceProxy;
namespace TimezoneClient
{
internal class Program
{
private static void Main()
{
using (TimezoneServiceProxy.Service1 svc = new Service1())
{
DateTime justDate = new DateTime(2008, 1, 2);
DateTime dateAndTime = new DateTime(2008, 1, 2, 3, 4, 5);
string response = svc.DisplayTimeAndDate(justDate,
dateAndTime);
Console.WriteLine(response);
Console.Write("Press ENTER to finish: ");
Console.ReadLine();
}
}
}
}
Give that a try and see what the result is.
--
John Saunders | MVP - Connected System Developer