Hello, I’m currently trying to convert something like this:
“2006-08-14T01:03:01.16Z”
into something like this:
“Monday 12th of June 2024”
If you know how to do it, please help me out with this.
Any help is appreciated!
Hello, I’m currently trying to convert something like this:
“2006-08-14T01:03:01.16Z”
into something like this:
“Monday 12th of June 2024”
If you know how to do it, please help me out with this.
Any help is appreciated!
Have you tried using this section of os.date?
Yes, and it didn’t really work. I don’t know if I used it correctly but I can’t get it to print the day of the week and the month.
Just figured out there’s a better version of os.date (kinda)
It seems to better fit what you want:
I think os.time could work, but I first need to convert the raw string into a lua DateTime, which I’m not able to do.
Is the date you showed in your topic the only one that comes up or is it completely random but in that format?
I’m getting this form a value called [“created”] when I get a user’s profile infos with HttpService:
![]()
The time it was created is
playerInfo["created"]
or just
playerInfo.created
“created” is essentially the name of the actual time value there
local dateString = "2006-08-14T01:03:01.16Z"
local isoDate = DateTime.fromIsoDate(dateString)
local formattedTime = isoDate:FormatLocalTime("LL", "en-us")
This will give you a formatted date of: August 13, 2006.
playerInfo.created , the second option
Yep, OP this is the solution.
30char
All of these “solutions” are well and good, but the definitive solution is this:
local isoDate = "2006-08-14T01:03:01.16Z"
local datetime = DateTime.fromIsoDate(isoDate)
print(datetime.FormatUniversalTime("LL", "en-us"))
This is strictly from the DateTime documentation.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.