Hi, so im making a text label say the players current time, and I’ve got the part where I get the time, but I don’t know how to format it. Someone please help!
local now = DateTime.now()
local minutesnow = now:ToLocalTime().Minute
print(now)
print(minutesnow)
this prints
CZXPEK
(czo)
September 17, 2023, 7:11pm
#2
never used DateTime but this should work:
local TimeNow = DateTime.now()
local LocalTime = TimeNow:ToLocalTime()
print("Current Time: "..LocalTime.Hour..":"..LocalTime.Minute..":"..LocalTime.Second)
1 Like
Thank you, but do you know how to convert it to standard display??
For example, if the time right now is 2 pm, the thing shows 14pm. How do I fix this?
Haystees
(Haystees)
September 17, 2023, 7:19pm
#4
print(DateTime.now():FormatLocalTime("LTS", "en-us"))
First argument for FormatLocalTime
is the format, and the second is the locale.
You can find a list of these in this article
1 Like
system
(system)
Closed
October 1, 2023, 7:19pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.