I designed my application considering the fact that, according to the specifications, should run on a server located in Italy and clients will be italian people only.
<
There are two issues with DateTime.Now and DateTime.Today on a client side and server side. When you pass DateTime object from client to Azure its Kind equals to Local and it contains time zone information. (June 10, 2011, 12:30am -7)
However, when you save it to the database the region information is lost. Subsequently, when reading this field from the database it creates DateTime with a Utc region (June 10, 2011, 12:30am 0)
Eventually, your client reads the datetime incorrectly.
There are several options to resolve this issue on a client side.
1) Convert DateTime to DateTimeOffset in Method parameters as well as in database. This will guarantee that your Local region (ie PST) will be saved in db
2) Use DateTime.SpecifyKind(dateTime, DateTimeKind.Unspecified) - this way the kind of DateTime is unspecified and subsequently saved as is in the db.
var timeNow = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Unspecified);
serviceClient.SaveTime(timeNow);
var dateTime = serviceClient.GetTime();
Be careful to call DateTime.Now on a server side. You better use DateTime.UtcNow. This time shouldn't be used for business data. Ideally, you would need to refactor your code and pass DateTime or DateTimeOffset from the client.