Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Changing DATETIME_GUI date format

    Cinema 4D SDK
    python r19
    2
    3
    665
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      AndreAnjos
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        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

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        A 1 Reply Last reply Reply Quote 3
        • A
          AndreAnjos @s_bach
          last edited by

          @s_bach
          Hi Sebastian,

          Thanks for your help!
          That makes sense!

          Andre

          1 Reply Last reply Reply Quote 0
          • First post
            Last post