You need to sign in to do that
Don't have an account?

Can any one tell me. How to calculate the working hours between login and logout timings in 12 hours format?
I have below these four fileds.
Morning_Sign_In__c
Afternoon_Sign_Off__c
Afternoon_Sign_In__c
Evening_Sign_Off__c
When the employee morning sign in and afternoon sign off for lunch break and after lunch login and evening logout. in between this situation i need calculate the total working hours of the day in 12 hours format
Morning_Sign_In__c
Afternoon_Sign_Off__c
Afternoon_Sign_In__c
Evening_Sign_Off__c
When the employee morning sign in and afternoon sign off for lunch break and after lunch login and evening logout. in between this situation i need calculate the total working hours of the day in 12 hours format
Create a formula field with return type as text.
I am assuming each record during save will have values into all these fields, in that case the below formula should work.
((DATEVALUE(Evening_Sign_Off__c))-(DATEVALUE(Evening_Sign_Off__c))) + (DATEVALUE(Afternoon_Sign_Off__c)-(DATEVALUE(Morning_Sign_In__c)))
Try above.
PLEASE SELECT THIS AS THE BEST ANSWER, IF YOU LIKE IT.
Thanks,
Rohit Alladi
All Answers
gettime(): Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this DateTime object.
ie. long moringsigin = Morning_Sign_In__c.gettime();
long afternoonsignoff = Afternoon_Sign_Off__c.gettime();
long signinmsec = afternoonsignoff - moringsigin;
//convert signinmsec to hours
hope this helps.
Can you suggest me for formula field.
Create a formula field with return type as text.
I am assuming each record during save will have values into all these fields, in that case the below formula should work.
((DATEVALUE(Evening_Sign_Off__c))-(DATEVALUE(Evening_Sign_Off__c))) + (DATEVALUE(Afternoon_Sign_Off__c)-(DATEVALUE(Morning_Sign_In__c)))
Try above.
PLEASE SELECT THIS AS THE BEST ANSWER, IF YOU LIKE IT.
Thanks,
Rohit Alladi
Did the above solution work for you?
In that case, please mark it as RESOLVED AND CHOOSE AS THE BEST ANSWER, so that it will helps others as well.
Thanks,
Rohit Alladi