Indicate whether current time of analogue clock is morning or afternoon (AM/PM)

Using iFrames, I have integrated several analogue watches from into my prototype, which show the current times at different locations of my client.

Now I need to display whether the shown times are in the morning (AM) or in the afternoon (PM). Is there a possibility in Axure to first determine the current time from a specific time zone, then to derive the correct one of the two possibilities (AM or PM) and then to display only this one?

Thank you very much in advance for any help!

Try this expression:
[[Now.toLocaleTimeString().slice(-2)]] (for example, use this with a Set Text action, no conditions necessary)
This should give you either “AM” or “PM” depending on the time. Note that I only tested this in a US timezone (CST) so I don’t know if the AM or PM portion is dependent on your timezone code set by the browser.

I know you can do what it is you want, but my date/time math is pretty poor.

Calculating AM/PM is pretty easy:
IF [[Now.getHours()]] is greater than 12 then set text “PM”
ELSE set text “AM”

As for different time zones you can get the UTC offset and then calculate for the the different zones but I don’t know the formula for it. Sorry!

1 Like

Thank you very much for the quick answer! Now I have something to work with. Have a nice day!

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