Lukiraq
(borge)
June 27, 2024, 5:14pm
#1
Basically im making a level browser. It has a sorting system, NEWEST and OLDEST. I have the os.date(“%c”) information of when the level was made. And I wanna turn that into a number so I can do: level.LayoutOrder=number. As simple as that.
By the way this is an example of what we get from os.date(“%c”): “Thu Jun 27 15:33:18 2024”
SpamLRBLX
(SpamLRBLX)
June 27, 2024, 5:17pm
#2
you can maybe use os.time() since it only has numbers
And It’s going to output this:
1719508584
2 Likes
Lukiraq
(borge)
June 27, 2024, 5:53pm
#3
Okay that worked, also is there any way of converting os.time() to os.date?
SpamLRBLX
(SpamLRBLX)
June 27, 2024, 5:57pm
#4
SpamLRBLX:
1719508584
Yes, there is!
you can use os.date("*t", Time)
again to get the time like this
os.date("*t", 1719508584) -- // The time I demonstrated
and it will output this:
{
["day"] = 27,
["hour"] = 19,
["isdst"] = true,
["min"] = 16,
["month"] = 6,
["sec"] = 24,
["wday"] = 5,
["yday"] = 179,
["year"] = 2024
}
Lukiraq
(borge)
June 27, 2024, 6:10pm
#5
I did it a bit differently , thanks for the help though! I did something like this:
local formattedDate = os.date("%d.%m.%Y", creationDate)
1 Like
system
(system)
Closed
July 11, 2024, 6:11pm
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.