function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Workflow rule criteria to find difference between data-time fields.


Please help in finding out the difference between two date and time fields.



I have to send an email notification if the case created date is greater than 4 hours.

So I written the rule criteria as NOW() - Date_Time_Opened>4.

But the workflow fails(it is not sending any email notification).

I also tried with Case escalation rule.,it is also not working.


Please help a better approach.






You can create a time based workflow that will fire 4 hours after the record is created.


You can extract hours from datatime field :


            Datetime dtm =;

            Integer in = dtm.hour();


Tryout your workflow by getting the hours of datetime field and use the condition as per the requirements. Refer Apex developer's guide for datetime methods.


Hope this helps.


Hi Pradeep,

Thanks for your reply.

I think the below mentioned solution is not possible directly  with Workflow I have to create formula field and then I have to use it in my workflow.

And also I have a doubt that my time based workflow I have to send email to different peoples with 10 min and 20 min gap.

I think time based minimum time starts with 30 minutes there a way to achieve this?