-1

I would like to combine a date and a time value, based on the condition, that the "time of the day" field is set to "Morning (09:00 - 13:00)". The syntax is working but when I look into the field, it is always still blank. Does anybody have a hint?

IF(
    text(Time_of_the_Day__c) = "Morning (09:00 - 13:00)",
    DATETIMEVALUE(text(Date__c) + " " + "09:00") + 8 / 24,
    DATETIMEVALUE(text(Date__c) + " " + "14:00") + 8 / 24
)
1
  • 2
    have you tested what the output of text(Date__c) + " " + "09:00" is? It might not be in the right format for DATETIMEVALUE.. Jan 29 at 16:06

1 Answer 1

0

What field type is Time_of_the_Day__c? Is it a picklist value? If so, have you tried ISPICKVAL() instead?

IF(
    ISPICKVAL(Time_of_the_Day__c, "Morning (09:00 - 13:00"),
    DATETIMEVALUE(text(Date__c) + " " + "09:00") + 8 / 24,
    DATETIMEVALUE(text(Date__c) + " " + "14:00") + 8 / 24
)

If not a picklist field, which field type is it?

2
  • Hi Neil. For picklist fields, ISPICKVAL(fieldname, "field value") effectively has the same outcome as TEXT(fieldname) = "field value" Jan 30 at 8:04
  • Thank you @GuyClairbois -- I appreciate the clarification.
    – Neil
    Jan 31 at 9: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.