Skip to reading
GDScript Programming & Godot

Time, files and text

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page
On this page

NowUnix()#

Code example
NowUnix() -> int

Read whole Unix seconds from the system clock.

Returns: Integer.

Code example
NowUnix()

DateTimeNow()#

Code example
DateTimeNow(utc: bool = false) -> Dictionary

Read current local/UTC calendar components.

Returns: Dictionary.

Code example
DateTimeNow(true)

DateTimeString()#

Code example
DateTimeString(utc: bool = false, use_space: bool = true) -> String

Format the current local/UTC system date/time.

Returns: String.

Code example
DateTimeString(false, true)

UnixToDateTime()#

Code example
UnixToDateTime(unix_time: int, _utc: bool = false) -> Dictionary

Convert Unix seconds to Godot’s UTC calendar dictionary.

Returns: Dictionary.

Code example
UnixToDateTime(0)

The retained UTC parameter is ignored for compatibility. Use native Time APIs for explicit date operations.

Page 78 of 378Permalink
Go to page