How would I get the date an asset was created?

Currently making a generator just for fun to find images from Roblox and show them in game.
Just wanna know what I would use to find the creation date of an asset.
For example, if I wanted the asset description I would just put

	local Asset = game:GetService("MarketplaceService"):GetProductInfo(num)
game.Workspace.Descript.SurfaceGui.TextLabel.Text = "Description:"..Asset.Description

For the assets description, however I don’t know how I’d get the date of the asset since I can’t find it in the API, nor any posts that seem to relate to this issue on the dev forum.

Cheers for any help.

I think .Created should give what is needed as it returns a time stamp of the creation of the asset, you will have to do some formatting to get only the date though

local Asset = game:GetService("MarketplaceService"):GetProductInfo(num)
print(Asset.Created)

To see if it works

2 Likes

I remember having to come across a similar issue, we did manage to fix it but you can get the Created value of the product, you’ll need to find some way to convert it back into a string however as it will return an iso8601 value

Worked perfectly, alittle too specific as in down to the hour it was created however this is a good solution, thanks for your help! (:

1 Like

Anytime! If you have anymore issues don’t be afraid to make another post!

You will have to find a way to do some changes to make it work for your needs and what not

Rewrote this script using better methods.

For UTC:

local marketService = game:GetService("MarketplaceService")
local date = DateTime.fromIsoDate(marketService:GetProductInfo(ASSETID).Updated)
local utcDate = date:ToUniversalTime()
print(utcDate) --returns dictionary with Year, Month, Day, Hour, Minute, Second, and Millisecond in UTC

For adjusted time:

local marketService = game:GetService("MarketplaceService")
local date = DateTime.fromIsoDate(marketService:GetProductInfo(ASSETID).Updated)
local adjustedDate = date:ToLocalTime()
print(adjustedDate) --returns dictionary with Year, Month, Day, Hour, Minute, Second, and Millisecond in adjusted time
1 Like