Creating a clock (12 hour clock)

I am trying to solve my issue on creating a 12 hour clock (via widgets) however, the UE4 time clock goes from 0-12 for the day and 12-0 for the night. My issue is I want to implement an AM and PM as well as the 12 hour styled clock but am unable to due to the sky reusing 0-12 but backwards. I have provided a sketch of what I mean in order to clarify. The upper clock is how UE4 implemented its time while the lower section is how I would like to approach it. The following picture is a blueprint within the widget to show what I am trying to do and what I have done so far.

Which sky actor are you using?

I am using the GoodSky actor, I got it from the unreal asset store in the permanently free section.

Good sky goes from 0 to 24. Do you want to make that AM and PM?

When you attach a directional lighting it goes from 0-12 and 12-0 (for night)

Ok, then there’s no way to know if it’s AM or PM, unless you’re assuming it’s moving in sequence.

EDIT: Ok, you can tell if it’s AM or PM from the X rotation of the directional light.

Like this ( this assumes you have set the rotation of the directional light to 0,0,0 ):

I noticed that you have the actor rotation set into float, how did you do that? whenever I summon get actor rotation I have the “rotation” type of variable instead of a “float” variable type. Here’s what I mean:

Right click on the pin and choose ‘break pin’.

Thanks! :smiley: It works! How would you go about implementing the 12 hour styled clock? Like I mentioned before the float variables go from 0-12 for day and 12-0 for night. Is there a way to work with that?

EDIT: Nevermind, my only concern is that the floats go beyond the 4 digit limit for example instead of 10:30 its 10:29999999. Do you know how to fix that?

Hi again, you can ignore the previous concern points that I made since I kind of fixed them, but I just found a small problem. When the Time switches from AM to PM the time goes from 11 to 0. Is there a way to somehow show a 12 instead of a 0? Thanks again!

It’s getting a bit messy, but:

Yes! Thank you!! This is exactly what I needed!

Hello. Can you share all the codes about a.m and p.m clock?

Here it is: Clock System (AM-PM Mode) posted by anonymous | blueprintUE | PasteBin For Unreal Engine