c4d.DateTimeData

DateTime data type (DATETIME_DATA) for the DateTimeControl GUI.

This type is called by value.

Inheritance

Members

DateTimeData.__init__(v)
Parameters:v (c4d.DateTimeData) – Copy constructor.
Return type:c4d.DateTimeData
Returns:The new DateTime data.
DateTimeData.GetDateTime()

Return the time.

Return type:time.struct_time
Returns:The time.
DateTimeData.SetDateTime(d, bSetData=True, bSetTime=True)

Set the time.

Parameters:
  • d – The new time.
  • bSetData (bool) – If this is False the date part of d is disregarded.
  • bSetTime (bool) – If this is False the time part of d is disregarded.

Here is a sample code that shows how to parse a string into a DateTimeData object:

import c4d
from datetime import datetime

# Parse the time string
dt = datetime.strptime('16.07.2011 03:37:12',"%d.%m.%Y %H:%M:%S")
dtd = c4d.DateTimeData()
# Fills the Data object with the DateTime object
dtd.SetDateTime(dt)

t = dtd.GetDateTime()
print t.day
print t.month
print t.year