There are several special situations here. I use "now" as the source, but you can configure it for your line:
select CASE --For 00:05, for example. WHEN (strftime('%H', 'now', 'localtime') - 12) = -12 THEN '12:' || strftime('%M', 'now', 'localtime') ||' '|| 'AM' --For 12:05, for example. WHEN (strftime('%H', 'now', 'localtime') - 12) = 0 THEN '12:' || strftime('%M', 'now', 'localtime') ||' '|| 'PM' --other am time WHEN (strftime('%H', 'now', 'localtime') - 12) < 0 THEN strftime('%H', 'now', 'localtime') ||':'|| strftime('%M', 'now', 'localtime') ||' '|| 'AM' ELSE --other pm time (cast(strftime('%H', 'now', 'localtime') as integer) - 12) ||':'|| strftime('%M', 'now', 'localtime') ||' '|| 'PM' END here_you_go_usa;
source share