How can I get the current UNIX timestamp?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Howl
:warning: Old Version Published before Godot 3 was released.

The question is pretty simple. How can I get the current UNIX timestamp in seconds in GDScript?

:bust_in_silhouette: Reply From: Howl

It’s as simple as OS.get_unix_time(). It will return an int being the number of seconds since January 1st, 1970, AKA the UNIX epoch.

why are you asking and answering your own questions? :slight_smile:

tiernich | 2016-03-30 16:47

It’s an usual thing on stackoverflow, and as I saw that some people were doing it here, too, I jumped onto the bandwagon :slight_smile:

Howl | 2016-03-30 16:51

oh, ok haha :smiley:

tiernich | 2016-03-30 16:53

@Howl ~ Just make sure not to overuse this :wink: better to answer questions on-demand than have many useless questions (I’m NOT implying that this question is useless)

Bojidar Marinov | 2016-03-30 17:25

I found this useful. Thanks!

misterBango | 2018-10-03 08:22

When there is no one asking because the question looks very noob, one can ask and answer by himself, which is great

Hanz | 2021-03-06 17:38

I found this useful and find the habit of asking and answering your own questions also useful. It’s so cheap to post something on a forum and so costly to wait for hours or days for someone to answer that posting in advance is a smart way to document our knowledge.

byrro | 2022-02-05 01:52

just what I was looking for, thank you.

ChildLearning.Club | 2022-10-31 19:23