I’m trying to form a query that will format times in a certain way.
What I have so far works in all cases except when the minutes portion of the timestamp are 00.
My aim is to omit minutes and the period between hours and minutes when the minutes are 00.
╔═══════════╗
║ StartTime ║
╠═══════════╣
║ 10:05 AM ║
╟───────────╢
║ 10:25 AM ║
╟───────────╢
║ 10:00 AM ║
╚═══════════╝
e.g. 10:00 AM becomes 10 am, 10:05 AM becomes 10.00 am.
This is my query right now:
to_char(timeslots.start_time, 'fmHH12.MI am') as start_time
I've gone through the PostgreSQL documentation on formatting but have had no luck.
Is this even possible?
Any help would be much appreciated!