c4d.DateTimeData

class c4d.DateTimeData

DateTime data type (DATETIME_DATA) for the DateTimeControl GUI.

This type is called by value.

Methods Signatures

DateTimeData.__init__(self, v)

type v

c4d.DateTimeData

DateTimeData.GetDateTime(self)

Return the time.

DateTimeData.SetDateTime(self, d[, bSetData, ...])

Set the time.

Inheritance

Parent Class:

Methods Documentation

DateTimeData.__init__(self, v)
Parameters

v (c4d.DateTimeData) – Copy constructor.

DateTimeData.GetDateTime(self)

Return the time.

Return type

time.struct_time

Returns

The time.

DateTimeData.SetDateTime(self, 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)