How to find part of the day Morning, Afternoon and Evening using Salesforce Formula

How to find part of the day Morning, Afternoon and Evening using Salesforce Formula

Sample Formula for Easter Standard Timezone(GMT or UTC – 4):

IF( HOUR(TIMEVALUE( CreatedDate - 4/24 ) ) < 12, "Morning",
IF( HOUR(TIMEVALUE( CreatedDate - 4/24 )) < 16, "Afternoon", "Evening" ) )

Output:

If the time is less than 12 PM, it will show as Morning.

If the time is greater than or equal to 12 but less than 16(4 PM), it will show as Afternoon.

If the time is greater than or equal to 18, it will show as Evening.

Leave a Reply