Unix timestamp - Description and usage in Roblox Studio

Also known as POSIX time is the duration in seconds of the Unix epoch. Unix epoch officially started on January 1, 1970 (UTC 5)

How to get Unix time in Roblox studio?

There are 3 ways to get it:

  1. tick() - Unrecommended to use, for more information visit this topic: Does tick() function still work? 18
  2. os.time() - This function from os library is more precise than tick(). You can also get the time duration between January 1, 1970, and a specific date.
  3. DateTime.UnixTimestamp - DateTime is a datatype specially created for Unix timestamp operations and this is one of its properties.

DateTime Datatype

As I said above this is a datatype specially created for Unix timestamp. I wanted to describe all its properties and functions but DevHub already did it so I will just send a link: DateTime

Usage

There is no use for Unix time in Roblox studio anymore. os library and time() makes it pretty useless… but not for DateTime. DateTime lets you do a lot of useful operations with Unix time.

The End

Thanks for reading the tutorial, hope it’s understandable. Have a nice day! :slightly_smiling_face:

8 Likes