help coding people, in godot when you:

func _ready():
var time =Time.get_date_dict_from_system()
var day = time["day"]
var month = time["month"]
var year = time["year"]
print ("%s %s,%s" % [month, day, year])

is there a way to display the month as a name instead of a number


You must log in to comment.

in reply to @Kaden's post:

I don't think there's a built-in method for that... here's a snippet that should work though:

const MONTH_NAMES := [
    "January",
    "February",
    "March",
    "April",
    "May",
    "June",
    "July",
    "August",
    "September",
    "October",
    "November",
    "December",
]

func convert_month_number_to_string(month: int) -> String:
    return MONTH_NAMES[month - 1]

I should have given you more details sorry!!!! You should have copy-pasted the code, yes, but then you also change your original code to this (note the commented line with the arrows):

func _ready():
    var time =Time.get_date_dict_from_system()
    var day = time["day"]
    var month = convert_month_number_to_string(time["month"]) # <<<<<
    var year = time["year"]
    print ("%s %s,%s" % [month, day, year])

then it should work! sorry!!

Pinned Tags