 ShowAll Questionssorted byDate Posted VSK98

# Calculate the hours between two datetime fields

Hi All,
I have created the formula field for calculating the hours between two datetime fields ........But it not showing exact hrs......My Piece of code

`TEXT(DATEVALUE (Closed) - DATEVALUE (Open)- 0.2916)`

```IF(
Floor(DATEVALUE (closed)-DATEVALUE (open))*24)>9
(Floor((DATEVALUE (closed)-DATEVALUE (open))*24)),
"0"& TEXT(Floor((DATEVALUE (closed)-DATEVALUE (open))*24))
)```

I tried both .......bt i couldn't get it

Pls suggest me

VSK98 Harsh Aditya 21
Hi VSK98,

`(Closed - open) *24` Ashlekh
Hi.

I've created a Text type formula and able to see the difference.

I took this case - Calculate the time difference between created record and lastmodified record.

Here is formula.

`TEXT(FLOOR((LastModifiedDate - CreatedDate)*24)) &' Hr '& TEXT(FLOOR(((((LastModifiedDate - CreatedDate)*24)-FLOOR((LastModifiedDate - CreatedDate)*24))*60)))&' Mins'`

-Thanks
Ashlekh Gera David Schmitke
Thanks for this solutuon Ashlekh, very helpful! WillSh1
Hi Ashlekh,

Thanks, great formula. Were you able to exclude weekends?

Cheers
Will Sibluself Sibluself
Hello
Thank you for help . (https://www.my-accountaccess.com/) Jayesh Kshirsagar
And can we calculate seconds and miliseconds also ?
if yes then what will be the formula to calculate seconds and miliseconds.