Custom column extract time (am/pm)

Hi,

In SQL I can do this:

case when extract(hour from regdate) < 12 then 'AM' else 'PM' end TimeOfDay

How do I Need to write this custom formula when I want to use the GUI for the question, and custom column;

Hi @cobalt
Basically https://github.com/metabase/metabase/issues/16870 and https://github.com/metabase/metabase/issues/19274
You would have to do some hacky hack, like:

case(substring(concat([Created At], ""), 12, 1) = "0" OR substring(concat([Created At], ""), 12, 2) = "10" OR substring(concat([Created At], ""), 12, 2) = "11", "AM", "PM")
1 Like

Thanks for the hacky hack.