globals

Fields:

owtime

globals.owtime : number

Relative game time for Overworld in tick.

owweather

globals.owweather : string

Overworld weather (CLEAR/RAIN/THUNDER).

timestamp

globals.timestamp : number

Current system timestamp.

online_players

globals.online_players : table

Server online players name list.

Functions:

get_realtime

globals.get_realtime([zoneid: string]): realtime

Name
Type
Description

zoneid

string

Optional. Time zone ID, such as "Asia/Shanghai". Defaults to UTC.

Gets real-time time for the specified time zone. Returns a realtime struct.

Search for time zones here.

get_datetime

globals.get_datetime([zoneid: string]): datetime

Name
Type
Description

zoneid

string

Optional. Time zone ID, such as "Asia/Shanghai". Defaults to UTC.

Gets date time for the specified time zone. Returns a datetime struct.

date

globals.date([format: string, zoneid: string]): string

Name
Type
Description

format

string

Optional. Lua format string. Defaults to "%Y-%m-%d %H:%M:%S".

zoneid

string

Optional. Time zone ID, such as "Asia/Shanghai". Defaults to "UTC".

Gets the current formatted time. Returns formatted string .

It is similar to Lua's os.data(). But it only returns time and supports specifying time zones.

How to use

Structs:

🕐 realtime

hour

realtime.hour : number

minute

realtime.minute : number

second

realtime.second : number

📅 datetime

year

datetime.year : number

month

datetime.month : number

day

datetime.day : number

Last updated