Datetime utils for Godot
Check out year of our lord for an example of it working in the wild!
var datetime = DateTime.now()
print(datetime.strftime("%D of %B, %Y %H:%M:%S"))
> "7th of january, 2022 12:04:30"
var tomorrow = datetime.add_days(1).day
print(tomorrow)
> 8
var next_month = datetime.add_months(1).month_name
print(next_month)
> "february"
var two_months_and_a_day = datetime.add_time({"day": 1, "month": 2})
print(two_months_and_a_day)
> "2022-03-08 12:04:30"
Currently not supported:
- Timezones
- Units smaller than a second
DateTime.from_isoformat()
with ISOFormat date strings that don't look likeYYYY-MM-DDTHH:MM:SS
orYYYY-MM-DD HH:MM:SS
(you can parse them usingDateTime.strptime()
if you know how they're formatted, though.)
🍪 This project was created with cookiecutter and the verillious/cookiecutter-godot project template.