+ Start a Discussion
T-HanT-Han 

Separate hours from now()

Scenario :

I need to compare the current hours to 14:00:00.

 

i.e.

Hours(now() - 14:00:00) and

If Answer > 1 min then perform 1 set of oprn ELSE other.

 

Can you help me out in this as to how it can be achieved.?

 

Olympus is falling, need assistance.

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
Jeff MayJeff May

You can extract the time portion from NOW() and do the compare. Here is a starting formula:

 

IF (VALUE(MID(TEXT( NOW() ), 12, 2)) >= 14, 'after 14:00', 'before 14:00')

All Answers

Jeff MayJeff May

You can extract the time portion from NOW() and do the compare. Here is a starting formula:

 

IF (VALUE(MID(TEXT( NOW() ), 12, 2)) >= 14, 'after 14:00', 'before 14:00')

This was selected as the best answer
T-HanT-Han

Thanks for the Response.

 

IF (VALUE(MID(TEXT( NOW() ), 12, 2)) >= 14, 'after 14:00', 'before 14:00')

 

after 14:00 and before 14:00 are both Picklist vals which needs to be auto-populated. 

Now I would like to know how to put in the Custom Picklist field in those 2 places?

 

Thanks fr the code..

Jeff MayJeff May

You can't set another field value in this formula, but if you want to get the value from 1 of 2 other picklist fields in this custom formula field, use the TEXT(PickListFieldName) in place of the 'after 14:00' and 'before 14:00' 

T-HanT-Han

Thanks Jeff. Olympus has been saved.. :) Kudos..!