Monday, February 20, 2012

Problem with Date & Time Value during synchronization

Hi All,
Again i am back with synchronization problem.
i believe this is the last query on this synchronization.
Now, i am able to upload / download records from local to online and vice versa.
i am checking the createddate & time for each record for downloading. The situation is as follow.
My application has been installed at our web server and also at our local office here. My colleague are entering record into online from Colombo. We are entering record here locally. Then we sync to merge records. Merging is working fine.
The problem is yesterday, i downloaded the records from online. After that my colleague from colombo has entered records in online. for those record the createddate has been my web server datetime which is 5:30 hrs behind us.
When i tried to download again today, those records are not downloaded due to time validation.

Hope you got my hurdles.
After working on, i found that instead of system.datetime.now, i need to use system.datetime.now.touniversal in the above scenario. I tried with local application and found out teh difference of 5 hrs or so. Also there was system.datetime.now.utcnow.
I want to know which one should i use to solve my problem. my colleagues will be entering record from Colombo, London. And i should be able to download it here locally.
Appreciate anyone help.


I think you should look into SQL Server NEWID and Time based validation using Universal time formating in C# to get the time issue resolved because if you use System.TimeSpan the day is 24hours and you go from there to add validation based on NEWID it is a function in SQL Server that creates a GUID. Hope this helps.

No comments:

Post a Comment