How do I get the age of a place from its ID?

My project:
I am trying to make a place where users can show off other games by typing in the place ID and creating a portal there. So far I fetch the place information such as the icon and title using MarketPlaceService.

The problem:
I want to make the game less prone to trolls by requiring the game to be a certain age. However, the closest thing to this I can find is AssetInfo.Created, which gives a timestamp in an odd format (the example given on the page for GetProductInfo is “2018-08-01T17:55:11.98Z”)
Is there a way to manipulate this timestamp to get the age of the place, or is there something else I am missing?

Other ideas:
I already check the account age of a player joining. One of my ideas was to check the account age of the creator of the place, however I cannot find a way to get the player’s age from their ID alone. If I could, this would be a good alternative.

That is ISO 8601 time format, you have to convert it or use string manipulation to read it.


As an addition to the post above, an example with string manipulation would be something like this. You could pass the GetProductInfo value into the variable ‘date’ and format the timestamp using :match() like so:

local date = '2018-08-01T17:55:11.98Z'

local year, month, day, hours, minutes, seconds, milliseconds = date:match('^(%d%d%d%d)-(%d%d)-(%d%d)T(%d%d):(%d%d):(%d%d).(%d%d)Z$')
print(year, month, day, hours, minutes, seconds, milliseconds)

You can use :gsub() or :match().

1 Like

This is exactly what I was looking for, and it now works. Thanks!