0

If the time is between 00:00 to 6:00 display "12AM - 6AM" .The field is text field. How do I convert the enter time as text to time from field time__c?

update:

Itz text field . Suppose i enter 14.00 in the field then it should display according to the range .

Example : If the time is between 00:00 to 02:59 display "12AM - 3AM" If the time is between 03:00 to 05:59 display "3AM - 6AM"

4
  • Can you please provide more details?
    – Anup
    Apr 17, 2015 at 7:45
  • Sorry, I am a bit confused. Could I confirm this? It seems like you have a field, which is a text field. You want to enter the time into this field as "12AM - 6 AM". The source field will be , eg, field__c. Is this correct? Apr 17, 2015 at 7:54
  • So I think if I am right. then you have two text fields, one field someone will enter the time in numerical clock mode, eg, 12:00, and a second field which will be a formula field, to display this in text form.... interesting... And it looks like you want it displayed in a range too... Apr 17, 2015 at 8:20
  • Yes , you got it.
    – AAA
    Apr 17, 2015 at 8:30

1 Answer 1

0

OK, first of all, let's call field 1 field_1__c and field 2 field_2__c.

field 1 will be a number field (for manual entry of time), and field 2 is text formula field for the display of range of time.

Field_2__c = IF((0.00 <= field_1__c <= 2.59), "12AM - 3AM", IF((3.00 <= field_1__c <= 5.59), "3AM - 6AM", IF((6.00 <= field_1__c <= 8.59), "6AM - 9AM", IF((9.00 <= field_1__c <= 11.59), "9AM - 12PM", IF((12.00 <= field_1__c <= 14.59), "12PM - 3PM", IF((15.00 <= field_1__c <= 17.59), "3PM - 6PM", IF((18.00 <= field_1__c <= 20.59), "6PM - 9PM","9PM - 12AM")))))))

12
  • I see a large number of problems with this though. 1. because field_1__c is a number field, what if someone fills in a number such as 11.89? How does that work? There is no really easy validation rules to tell a user to fill in decimal points to be below 0.60. 2. What if someone gets lazy, and just puts in a number '2'? what does that mean? how do you define this? Probably a better solution is to have field_1__c as a datetime field.... let me think about this. Could I please check with you that you are not concerned with the date, and all you care about is the time? Apr 17, 2015 at 8:52
  • Could I please check with you that you are not concerned with the date, and all you care about is the time? Apr 17, 2015 at 8:52
  • Field 1 is also a text field not numeric
    – AAA
    Apr 17, 2015 at 9:04
  • What about bad data entries? Apr 17, 2015 at 9:06
  • For example: 1. because field_1__c is a number field, what if someone fills in a number such as 11.89? How does that work? There is no really easy validation rules to tell a user to fill in decimal points to be below 0.60. Apr 17, 2015 at 9:06

You must log in to answer this question.

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