Changing DATETIME_GUI date format



  • Hi everyone,

    Trying to convert the Month/Day/Year to Day/Month/Year format and unfortunately it always default to the Month/Day/Year.
    Is there anything I should be considering?

    dt_settings = c4d.BaseContainer()
    dt_settings.SetBool(c4d.DATETIME_DATE_CONTROL, True)
    dt_settings.SetBool(c4d.DATETIME_CALENDAR_OPEN, True)
    self.date = self.AddCustomGui(TRELLO_DEAD_TEXTBOX, c4d.DATETIME_GUI, "", c4d.BFH_LEFT, 0, 0, dt_settings)
    
    dt = datetime.strptime('16.07.2011', "%d.%m.%Y")
    dtd = c4d.DateTimeData()
    dtd.SetDateTime(dt)
    self.date.SetDateTime(dtd)
    

    Output:
    0_1551946822831_80a9e039-19d6-4344-9088-e6e2e943b4cb-image.png

    Thank you all in advance! ☺

    Andre



  • Hello,

    the date format is actually language depended and hard-coded.

    You can look into the file \resource\modules\xtensions\strings_en-US\c4d_strings.str in your Cinema 4D installation (assuming you have installed the English language pack). There you find the line

    IDS_DATE_FORMAT "M / D / YYYY";

    This string defines how the date is formatted in the given language. So you cannot change the behaviour of the DATETIME_GUI. You can only switch the language.

    best wishes,
    Sebastian



  • @s_bach
    Hi Sebastian,

    Thanks for your help!
    That makes sense!

    Andre


Log in to reply