Can I get current system time in Blueprints?

Hello,

I just wanted to ask if it was possible to gather the current system time in blueprints ? I need it to synchronize the game with a specific timezone.

Thanks in advance

Engines got functions for that, but it it’s seems it Blueprint bindings missing for that
https://docs.unrealengine.com/latest/INT/API/RuntimeModules/Core/Misc/FDateTime/index.html

So solution for now is create you own bindings in C++, by making you own blueprint callable static functions that call those functions.

1 Like

Yeah I was thinking about going the C++ way if BP doesn’t have it of course. Maybe I’ll try to make a node that does it myself if I can. Otherwise this is a request to devs.

Here you have tutorials that may help you

Just remember to use static functions or else your node will require input of class instance as (2nd link) tutorial uses, and don’t use CompactNodeTitle meta it looks ugly :stuck_out_tongue: tutorial from 1st link use them. I think best for you will be use of BlueprintPure like in 3rd link

Thanks. I had started with simply an actor that I would instanciate which was ok for me. Like I put one RealTimeClock actor in the world that doesn’t sound too bad to me.

The problem though is that FDateTime, FTimeSpan and double are not allowed types in blueprints haha. I guess I will just clamp the seconds to floats.

Anyways as this was about blueprints I’ll wait to see if a staff member replies with something that would potentially be under development and released later before flagging an answer as a solution.

In the meantime for those interested here’s what I did for a synchronized real-time day-night cycle:

http://puu.sh/8nxMG.jpg

You could use static functions so you would not need to spawn Clock object :slight_smile:

Yeah I know I will eventually have a look at that too I just wanted to do what I could first. Thanks for your links though.

But it’s like the sun. You spawn only one but you should spawn one. Most projects won’t require this clock so I like it that way.

It’s 2022 and this answer still comes up in searches…

The correct answer appears to be to use the “now” node, but I also had to search around for it because “get time” doesn’t return it even in UE5:

bild

6 Likes