Aller au contenu principal

DateTime():valueOf()

Returns the primitive value of the DateTime object, which is the number of milliseconds since the Unix epoch.

Signature

valueOf(): number

Returns

  • Type: number
  • The number of milliseconds since the Unix epoch.

Examples

local now = DateTime()
local milliseconds = now:valueOf()
toast("Milliseconds since epoch: " .. milliseconds) -- e.g., 1705301400123