I have a datetime field field1
which i am populating using NOW()
formula.
At some point later i want to know the difference between NOW()
and field1
in number of days.
I tried NOW()-field1
and DATETIMEVALUE(NOW()) - DATETIMEVALUE(field1)
, but it does not seem to be correct.
I am storing this result in a number field which can store 6 decimal places. But when i multiply the value by 60*24, it does not return correct result.
If the difference is 12 hours between NOW
and field1
, I want the field to have .5 as value. If the difference is 6 hours, it should have .25
Best Answer
I think your approach is right, but you should use only 2 decimal places in your formula number field.
I have tested the following:
NOW()
field (DateTime formula)NOW()- ut__Datetime__c
(number formula, 2 decimal places)Works well: