I've seen a lot of ways to accomplish this but all seem pretty different from what I feel like should be a simple answer. My current project is an Alarm app. The only issue I'm having is time formatting coming from the TimePicker specifically. Currently the user taps a time picker button, then .AfterTimeSet should set a label to the selected time.
I understand there are many formatting options for time within the Clock's functions but I'm struggling to find how this would cross over to the picker, if it can at all. All I need is the result of a 12hr format from the TimePicker.Hour and .Minute.
At first I was just running with using .Hour/.Minute; My .AfterTimeSet file currently shows the format method. I bloated my code with globals trying to do conversion shenanigans. As such, my logic comes from taking the time picker hour/minute, set them to a global for Clock validation later, convert that time into what is my attempt at making a 12hr format via Convert_time procedure, two blocks one with globals and one with the original picker calls. Regular calls were working well enough but I kept getting strange outcomes related to 12AM/12PM, especially if 0's are involved due to the 24hr format. So I switched to the bloated global variable method thinking it was an issue of passing the specific TimePicker value (My first attempts with conversion were inside the AfterTimeSet procedure, so I made it's own procedure trying to figure this out).
Most posts I can find end up using the Clock date procedures to present the time. Would setting the label to Clock.Now during the AfterTimeSet be accurate if the label is only showing HH:MM?
The only thing I can think of left is trying to modify my current method to force in 0's if they're missing, such as 00 rather than 0:XX for 12AM. I did see a method of using some math to convert minutes/hours/seconds and shift it around that way... But again, I've got to be missing something simple right?