I have a Metabox custom CPT which has a timepicker field in the format h:mm TT (so 9:45 AM).
I want to be able to sort the query loop by the time in each post but I can’t get anything to work. I’ve tried meta value and meta value numeric to order by.
Yes, your screenshot is how I have it set for the front end display. I checked in the database and the values are being stored in that format too, so 9:45 AM. I can’t see where to change the database format but I guess for this to work, it would need some php to convert 12hr time to 24hr time and then echo the function in the meta value field.
yeah right. The Meta Box date field has an option to differentiate between the visual format and the save format. This does not apply to the time field though.
So I would not specify a specific time format in the field settings but use a Meta Box hook like this: