Automatically Convert DateTime Object to Azure Mobile Services

I have an Azure Mobile Service with a .NET backend. I am using ApiController

which creates an object DateTime

and returns it to a .NET client (specifically a Windows Phone app).

When this one DateTime

, returned as part of an object, is returned to the client, the time is automatically converted to a different time. It looks like Azure assumes it DateTime

is in Utc format and tries to convert it to local time.

I don't want this to happen because it DateTime

should be the same for everyone using the application and therefore converting to local time is not desirable.

I tried to explicitly try to get Azure not to convert the date by trying something like this:

dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Unspecified);

      

However, this has no effect.

How can I ensure that the objects DateTime

returned by Azure Mobile Services from the .NET backend are not converted when returned to the .NET client?

+3


source to share





All Articles