I have tried the following but it's not working,

var myDate = Time.get_datetime_dict_from_datetime_string("2020-01-30 00:00:00", false)
myDate .day = myDate .day + 5
var newDateStr = Time.get_datetime_string_from_datetime_dict(myDate , true)

What is the correct way to add some days to myDate?

  • const SECS_PER_DAY: int = 24 * 60 * 60
    var my_date_time: int = Time.get_unix_time_from_datetime_string("2020-01-30 00:00:00")
    my_date_time += 5 * SECS_PER_DAY
    var new_date_time_str: String = Time.get_datetime_string_from_unix_time(my_date_time)

    This is untested code, and may have errors, but that's the general approach.

    I've used your method in another language (maybe Perl or PHP), but I don't think GDScript supports it.

const SECS_PER_DAY: int = 24 * 60 * 60
var my_date_time: int = Time.get_unix_time_from_datetime_string("2020-01-30 00:00:00")
my_date_time += 5 * SECS_PER_DAY
var new_date_time_str: String = Time.get_datetime_string_from_unix_time(my_date_time)

This is untested code, and may have errors, but that's the general approach.

I've used your method in another language (maybe Perl or PHP), but I don't think GDScript supports it.