How to get operating system time?

Godot Version

4.5

Question

I’m wanting to make a digital clock with a label, but I can’t find a way to retrieve the local time from my laptop. I’ve seen people get the time using OS.get_time() but it gives me an error saying the function doesn’t exist. Is there a different way to do it?

2 Likes

Time and a variety of other things were moved out of OS in the move to Godot 4; there’s a note about it at the top of the OS docs. The examples with OS.get_time() are presumably from Godot 3.x projects.

2 Likes