Is there any build in method to do this cuz I cant find it ? I have this simple code and I want to show it in (DD-MM-YYYY) format how to do it?
var date = Time.get_date_string_from_system()
datelabel.set_text(str(date))
Convert (YYYY-MM-DD) to (DD-MM-YYYY) ?
- Edited
DanchoLudiq You can use Time.get_date_dict_from_system()
and build the string yourself from data in the returned dictionary.
- Edited
Don't get it as a string?
You can use Time.get_date_dict_from_system()
instead. You now have a dictionary of keys: year
, month
, day
, and weekday
instead.
edit: oh what a snipe. Also can use get_datetime_dict_from_system()
to have hours, minutes and seconds included too.
Here's a quick way to do it using string formatting:
var d = Time.get_date_dict_from_system()
var d_string = "%02d-%02d-%04d"%[d["day"], d["month"], d["year"]]
Thank you all.