0

I have a process builder by which I am calculating the time difference between NOW() and another Case object date field.

My formula goes like this

Time_Spent__c = NOW() - Start_Time__c

However when Time_Spent__c is not getting populated correctly. I saw that all time differences are calculated in GMT. What I would like to understand is the difference comes in what value- s(seconds) or mS (milliseconds) >

I needed my value in hours, so I used the below formula

 Time_Spent__c = ((NOW() - Start_Time__c)/(1000*60*60)) - assuming the difference is coming in milliseconds. However the value is still not coming up properly. If (NOW() -Start_Time__c ) equals 5. The time spent is coming as 1.03 which is definitely not correct. Is is a problem of the time zone

Also Start_Time__c was defaulted to NOW() when the case was created.

2
  • try changing your formula to text and use TEXT(NOW() - Start_Time__c) Dec 6, 2018 at 12:10
  • @rahulgawale , I cannot change it to text. Is there any way of doing it with DateTime field.
    – Madhurima
    Dec 6, 2018 at 15:16

2 Answers 2

0

Now() - SpecifiedDateTime returns the difference in miliseconds.

1
  • I tried it. I needed my value in hours, so I used the below formula Time_Spent__c = ((NOW() - Start_Time__c)/(1000*60*60)) However the value is still not coming up properly. If (NOW() -Start_Time__c ) equals 5. The time spent is coming as 1.03 which is definitely not correct. Is is a problem of the time zone?
    – Madhurima
    Dec 6, 2018 at 12:00
0

If the date/time field in case is a converted field, there can be time zone calculation issue, as during formula compile time, the underlying system cannot determine time zone of viewer.

You can convert Time field to text as TEXT(NOW()).Byt this function returns the time with respect to the day as well as date. If we need time explicityly we may use TIMENOW().

Debug: NOW() returns value in millisecond, can we try to seperately observe NOW() and Start_Time__c by removing the other one by one?

Visit the link and scroll to the bottom: https://developer.salesforce.com/docs/atlas.en-us.formula_date_time_tipsheet.meta/formula_date_time_tipsheet/formula_using_date_datetime.htm#

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.