Question : .NET CE C# program not updating with time zone change

I've got a custom application running on a windows mobile smart phone. The person operating the phone lives in a different time zone and sometimes starts the application before arriving to work (and passing over the time zone). When they clock in or out on their phone it sometimes gets the time from the last time zone they were in and not in the current time zone that the cell phone is using. I am using System.DateTime.Now to get the current time.

It looks.net uses the current time when the application was launched and doesnt use the system time on the device? Is it possible to force the application to refresh its time to the actuall time of the smart phone?

Answer : .NET CE C# program not updating with time zone change

Hi,

You may have the problem if it is .Net CF 2.0 SP1, the below links gives you a solution
http://www.pcreview.co.uk/forums/thread-3686932.php
http://www.eggheadcafe.com/software/aspnet/33592837/datetimenow-returns-inco.aspx

DateTime.Now will gives you the system time for me properly in .Net CF 2.0 SP2, i never faced this problem.For sending to server, you can use UtcTime
DateTime.UtcNow.ToString("s", CultureInfo.InvariantCulture)
The above sentence gives you the current time in UTC and invariant of all cultures.

Regards
Deepu
 
Random Solutions  
 
programming4us programming4us