I'm attempting to set up an email template based on the time of day to begin an email with either a "Good Morning" or a "Good Afternoon" greeting based on the time of day that the email was sent.

I see that the {!Now()} function provides me with the current date and time. However, I'm rather new to Salesforce, and haven't been able to figure out how to capture just the time for a comparison in a conditional statement something like Good {!if {!Now()} < "12:00 AM", "Morning", "Afternoon"}.

I've done quite a bit of searching, and haven't yet been able to find an answer to this question. Any help or reference material would be most appreciated. I've already scoured the Salesforce help pages (including the Formula Operators and Functions page), and browsed the internet for a solution.

1 Answer 1


Based on this thread, you can do something like:

IF(VALUE(MID(TEXT(NOW()), 12, 2)) < 12, "Morning", "Afternoon")
  • This partially resolves my inquiry...however the output of NOW() is in GMT, and I need to instruct it to look at the time from a CST perspective (which unfortunately is not my time zone). Commented Oct 1, 2015 at 22:29
  • @esme_louise That is not remotely a part of your OP.
    – Adrian Larson
    Commented Oct 1, 2015 at 22:45
  • 1
    Helpful link: Finding the Hour, Minute, or Second from a Date/Time
    – Adrian Larson
    Commented Oct 5, 2015 at 17:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .