I have a custom object based on the record Created time, I am trying to derive a formula to check whether it's in AM or PM time zone. But due to some UTC conversion issues I am getting a different time in formula.

The formula :

IF( (VALUE(RIGHT(LEFT(TEXT(Call_Datetime_vod__c) , 13),2)) > 12.00) , 'PM', 'AM')

Suppose, 2015-03-17T09:46:41.000Z is my datetime value in system field, I am getting 08 as hour value in my formula field and hence the calculation is getting wrong when the system field's hour is 13 I am getting it as 12.

1 Answer 1


I think you need to confirm your assertion that the hour is returned incorrectly. If you create a text formula field for RIGHT(LEFT(TEXT(CreatedDate),16),5), you will see the GMT hour and minute. Temporarily set your timezone to GMT and confirm with the contact screen and/or your custom object screen.

The problem I find with your AM/PM conversion is the ">" should be ">=" IF( (VALUE(RIGHT(LEFT(TEXT(Call_Datetime_vod__c) , 13),2)) >= 12.00) , 'PM', 'AM') Everything during the 12 hour is PM and your only reading the hour, so you aren't > 12.00 until 13.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.