I want to find the game updated date via script.
I’ve looked on the developer hub and devforum and haven’t found an good method to do this.
Any help would be apricated.
I want to find the game updated date via script.
I’ve looked on the developer hub and devforum and haven’t found an good method to do this.
Any help would be apricated.
Have you looked at this?
local PlaceIDToFind = 00000000000000000000
local MarketService = game:GetService("MarketplaceService")
local PlaceInfo = MarketService:GetProductInfo(PlaceIDToFind)
print(PlaceInfo.Updated)
Thanks that works. I saw that but thought it wouldn’t work with games. What would be the best way to parse that information?
From what I understand on the Dev API, the Updated
value is a timestamp
type so you may need to convert it into a string
if you want to get the exact date:
There’s also a code example on here that does show you how to change timestamps to strings I believe (In os.date format string)
Mine comes out as this:
2021-03-28T04:41:08.893Z
Wait it’s an iso8601 format
Hm, try formatting it as a Dictionary? That could work a bit easier I believe:
local TimeStamp = NumberHere
local DateStats = os.date("*t", TimeStamp)
print(DateStats)
Decided to do it with basic string formatting.
Final script:
local label = script.Parent
local marketService = game:GetService("MarketplaceService")
local updatedDate = marketService:GetProductInfo(game.PlaceId).Updated
label.Text = "v" .. string.gsub(string.split(updatedDate, "T")[1], "-", ".")
Output: v2021.04.03
I was using this to show the version of my game instead of game.PlaceVersion
.
Yeah I ended up doing this. It’s a much better solution.
tysm! Now I can add this to my game! ty very much!
But can you convert it to est? I was wondering
or is it already converted?.. Im not sure