Skip to content

nut.date

Date/Time module.

Handles date and time calculations, formatting, and synchronization between server/client.

Functions

nut.date.syncClientTime (client)
nut.date.syncClientTime

Sets currency display properties (server only)

Parameters:

Client client Player to sync with

nut.date.get ()
nut.date.get

Gets current in-game timestamp. Returns a number that represents the custom time. The year is always the current year for compatibility, though it can be editted with nut.date.getFormatted

Returns:

number Unix timestamp of current in-game time

nut.date.getFormatted (format, dateNum)
nut.date.getFormatted

Takes the time number if provided, or current time and applies a string format to it

Parameters:

string format Date format string (see os.date)

number dateNum optional Timestamp to format (defaults to current time)

Returns:

string Formatted date string

nut.date.initialize ()
nut.date.initialize

Internal

This is used internally - although you're able to use it you probably shouldn't.

Checks the time difference between the old time values and current time, and updates month and day to advance in the time difference. Creates a timer that updates the month and day values, in case the server runs continuously without restarts.

nut.date.save ()
nut.date.save

Internal

This is used internally - although you're able to use it you probably shouldn't.

Save the current actual time. This allows the time to find the difference in elapsed time between server shutdown and startup