Skip to content

Date Shared โ€‹

Date is a powerful module to manage dates in your scripts.

JO Functions โ€‹

jo.date.convertMsToInterval() โ€‹

A function to convert a time in ms to a readable string

Syntax โ€‹

lua
jo.date.convertMsToInterval(ms, lang)

Parameters โ€‹

ms : integer

The duration in ms

lang : table Optional

The list of translatable strings
Use false to disable

lang.ms : string - "ms"

lang.s : string - "s"

lang.h : string - "h"

lang.d : string - "d"

lang.s : string - "s"

Example โ€‹

lua
local gap = 10000003
local forHumain = jo.date.convertMsToInterval(gap)
print(forHumain)
-- Expected output: '2h, 46min, 40s, 3ms'

jo.date.now() โ€‹

A function to get the current time

Syntax โ€‹

lua
jo.date.now()

Return Value โ€‹

Type : integer

The current time in ms

Example โ€‹

lua
local now = jo.date.now()
print(now)

Last updated: