I have some basic questions about the date/time fields in Salesforce. I know Salesforce stores the date and time fields in GMT format in the object when a record is created or updated and also retrieves them in GMT format when a record is queried.
I am working on an REST api integration where I am getting the details of a asset from a third party system. I need to compare the API response values with what is available in Salesforce and if they are different, I need to update the asset in Salesforce. The fields that I will be comparing are below.
InstallDate PurchaseDate Cancelled_Date__c (Custom Field) Name ProductCode SalesChannels__c (Custom Field) ProductOptions__c (Custom Field)
I am not sure of a sureshot way to compare the InstallDate, PurchaseDate and Cancelled_Date__c. When I query the Asset in Salesforce, I am getting these in GMT, but the webservice is sending these values in CST. I used the timezone class to determine the offset and use that, but it does not provide the results what I want. I work in IST and I am getting a result when I test my service in the morning and a different result when I test the service in the evening.
Can someone help on how do I go about comparing these date fields to determine whether an asset needs to be updated or not?