0

I have a formula(text) field created that fetches only the time part of a date/time field.

Formula(Text) field: Time__c

However, upon sorting list view by that formula field, it does not display the expected result.

For example:

10:00 AM 9:00 AM

I've been clicking the ascend arrow but it always puts the record with 10:00 AM value first and always tops the 9:00 AM. Seems like it treats it as 1 and not as 10.

How could I sort this field properly?

1 Answer 1

1

That filtering is correct. Text filtering is simply alphanumeric, and just as A... comes before B..., you similarly observe 1... comes before 9....

The simplest approach is just to change the Formula Return Type to Time rather than Text. Then sorting should work as you expect.

Formula Return Type Radio Select

1
  • For initial testing, I've created a new formula field with Time return type, and tried with this value: TIMEVALUE(Date_Time_Field__c). However, time was not displayed in HH:MM AM/PM format. It looks something like this: 2:01:00 AM. Plus time is not in local format (user settings follows local time).
    – lol
    Commented Jun 2, 2019 at 15:49

You must log in to answer this question.

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