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
Mayuri NehulMayuri Nehul 

how to calculate half day

Hi All
I am working on creating Leave Management Application.

I want to add 2 types of leaves like half-day and full-day excluding weekends.

I am able to figure out the formula for Full day leave but I am not able to understand how can I achieve half day leave requirement.

For that, I have used 2 fields from_date__c and to_date__c which is of date data type.

Do I need to change it to DateTime? Please help me to achieve this requirement.


Your help will be appreciated.

Thanks in advance
 
ShivankurShivankur (Salesforce Developers) 
Hi Mayuri,

Check out the formula expression used to calculate the duration between 2 date fields with help of following link:
https://focusonforce.com/configuration/subtract-two-date-fields-to-calculate-duration-of-time/

Once you are able to calculate the duration between 2 dates fields and based on evaluated value, you can decide whether its full day leave or half day leave.

Hope above information helps, Please mark as Best Answer so that it can help others in the future.

Thanks.
mukesh guptamukesh gupta
Hi Mayuri,

You need use two chack box with calander date 

User-added image
if you need any assistanse, Please let me know!!


Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh