You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@DDTyphos
As a first simple and naive approach you can use this.
I think, if Dreamlo doesn't change it's format, this will work fair enough.
Nevertheless, you should implement error handling and maybe also convert the time to the user's timezone (if Godot can provide it to you?)
var date = "2/4/2020 8:45:06 AM"
var splitup = date.split(" ", false, 0)
var dateParts = splitup[0].split("/", false, 0)
var timeParts = splitup[1].split(":", false, 0)
var isPm = splitup[2] == "PM"
var hour = int(timeParts[0])
if isPm:
hour = (hour + 12) % 24
var paramsInOrder = [
int(dateParts[1]),
int(dateParts[0]),
dateParts[2],
hour,
int(timeParts[1]),
int(timeParts[2])
];
var parsed = "%02d.%02d.%s %02d:%02d:%02d" % paramsInOrder
print(parsed)
Tipp: You can use an online GDScript Interpreter for such simple stuff, so you don't have to always launch the application and play for 20s to test :)
e.g. This one
Highscore Dates look like this:
{ dreamlo: { leaderboard: { entry: [{ date: 2/4/20207: 28: 55AM, name: Nick, score: 106, seconds: 0, text: }, { date: 2/4/20207: 28: 47AM, name: Dario, score: 105, seconds: 0, text: }] } } }
Nobody likes the US Date Format, would be better if we stick to ISO 8601, which would be:
2020-02-04 08:28:55
-> Also account for the right timzeone (we seem to be one hour more than dreamlo.com) and for the 24 hours time format (no one likes AM/PM).
Godot does not seem to have date functions, so this could be a tough nut!
The text was updated successfully, but these errors were encountered: