How to add a timestamp in an embed?

Hey, I’m trying to make better join and leave notifications, but I cant figure out how to add a timestamp to an embed using roblox scripting to execute the embed to a discord server.

For example:
Player joined
A player has joined the game.
4:32 PM (timestamp)

Does anyone know how to do this?

You might be able to use DateTime for this:

local now = DateTime.now()
local timestamp = now:FormatLocalTime("LT", "en-us")

print(timestamp) --> e.g. "3:35 PM"

In terms of the Discord side of things, I am not sure. I’m unfamiliar with their API.

1 Like

If its formatting local time then it must not work, I want it to function through a server script

Then use this:

local dt = DateTime.now()
local timestamp = dt:FormatUniversalTime("LL", "en-us")
print(timestamp)

The date will be in UTC time

2 Likes