How to make am and pm in 12h format

so im planning to make some kind of routine widget (in klwp) but i face a problem which that i either use the 24 format for the whole thing which isnt ideal for clock and stuff like this or use 12 format but then any code thats related to time gets cooked as it treats 1:00pm as 1:00am

(extra clarifying stuff)
Example:
i wanna make a daily routine widget that changes display based on different times of the day

any thoughts on how to do that?

Hi there,

In regards to the checking of AM or PM time, here’s my tips:

  • The $df(a)$ function is used to display the AM/PM of the time. The output of this function is “AM” or “PM” (if the system uses 12h format), or an empty string if it’s 24h format.
  • Use $if(df(a)="", "24h format", "12h format") to check whether it’s 24h or 12h time format.
  • If it is 24h format, then subtract 12 from the time (to the time is in 12h format) before using the time, or else use the time directly.

I hope this would help.
:smiling_face::+1:

1 Like

nice buddy that actually fixes my problem i didn’t know of that function but now it opens alot of possiblities with and , or operators its gonna be way easier

ty for replying

This topic was automatically closed 25 days after the last reply. New replies are no longer allowed.