# pydicom.valuerep.DT

class pydicom.valuerep.DT(*args: Any, **kwargs: Any)

  Store value for an element with VR DT as `datetime.datetime`.

  Note that the `datetime.datetime` base class is immutable.

  __init__(*args: Any, **kwargs: Any) → None

    Create a new DT element value.

  Methods

  `__init__`(*args, **kwargs) | Create a new DT element value.
  `astimezone` | tz -> convert to local time in new timezone tz
  `combine` | date, time -> datetime with same date and time fields
  `ctime`() | Return ctime() style string.
  `date`() | Return date object with same year, month and day.
  `dst`() | Return self.tzinfo.dst(self).
  `fromisocalendar` | int, int, int -> Construct a date from the ISO year, week number and weekday.
  `fromisoformat`(object, /) | string -> datetime from a string in most ISO 8601 formats
  `fromordinal` | int -> date corresponding to a proleptic Gregorian ordinal.
  `fromtimestamp` | timestamp[, tz] -> tz's local time from POSIX timestamp.
  `isocalendar`() | Return a named tuple containing ISO year, week number, and weekday.
  `isoformat` | [sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].
  `isoweekday`() | Return the day of the week represented by the date.
  `now`([tz]) | Returns new datetime object representing current time local to tz.
  `replace` | Return datetime with new specified fields.
  `strftime` | format -> strftime() style string.
  `strptime` | string, format -> new datetime parsed from a string (like time.strptime()).
  `time`() | Return time object with same time but with tzinfo=None.
  `timestamp`() | Return POSIX timestamp as float.
  `timetuple`() | Return time tuple, compatible with time.localtime().
  `timetz`() | Return time object with same time and tzinfo.
  `today`() | Current date or datetime: same as self.__class__.fromtimestamp(time.time()).
  `toordinal`() | Return proleptic Gregorian ordinal.
  `tzname`() | Return self.tzinfo.tzname(self).
  `utcfromtimestamp` | Construct a naive UTC datetime from a POSIX timestamp.
  `utcnow`() | Return a new datetime representing UTC day and time.
  `utcoffset`() | Return self.tzinfo.utcoffset(self).
  `utctimetuple`() | Return UTC time tuple, compatible with time.localtime().
  `weekday`() | Return the day of the week represented by the date.

  Attributes

  `day` |
  `fold` |
  `hour` |
  `max` |
  `microsecond` |
  `min` |
  `minute` |
  `month` |
  `resolution` |
  `second` |
  `tzinfo` |
  `year` |
  `original_string` |

  astimezone()

    tz -> convert to local time in new timezone tz

  classmethod combine()

    date, time -> datetime with same date and time fields

  ctime()

    Return ctime() style string.

  date()

    Return date object with same year, month and day.

  dst()

    Return self.tzinfo.dst(self).

  classmethod fromisocalendar()

    int, int, int -> Construct a date from the ISO year, week number and weekday.

    This is the inverse of the date.isocalendar() function

  classmethod fromisoformat(object, /)

    string -> datetime from a string in most ISO 8601 formats

  classmethod fromordinal()

    int -> date corresponding to a proleptic Gregorian ordinal.

  classmethod fromtimestamp()

    timestamp[, tz] -> tz’s local time from POSIX timestamp.

  isocalendar()

    Return a named tuple containing ISO year, week number, and weekday.

  isoformat()

    [sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM]. sep is used to separate the year from the time, and defaults to ‘T’. The optional argument timespec specifies the number of additional terms of the time to include. Valid options are ‘auto’, ‘hours’, ‘minutes’, ‘seconds’, ‘milliseconds’ and ‘microseconds’.

  isoweekday()

    Return the day of the week represented by the date. Monday == 1 … Sunday == 7

  classmethod now(tz=None)

    Returns new datetime object representing current time local to tz.

    > tz

    >   Timezone object.

    If no tz is specified, uses local timezone.

  replace()

    Return datetime with new specified fields.

  strftime()

    format -> strftime() style string.

  classmethod strptime()

    string, format -> new datetime parsed from a string (like time.strptime()).

  time()

    Return time object with same time but with tzinfo=None.

  timestamp()

    Return POSIX timestamp as float.

  timetuple()

    Return time tuple, compatible with time.localtime().

  timetz()

    Return time object with same time and tzinfo.

  classmethod today()

    Current date or datetime: same as self.__class__.fromtimestamp(time.time()).

  toordinal()

    Return proleptic Gregorian ordinal. January 1 of year 1 is day 1.

  tzname()

    Return self.tzinfo.tzname(self).

  classmethod utcfromtimestamp()

    Construct a naive UTC datetime from a POSIX timestamp.

  classmethod utcnow()

    Return a new datetime representing UTC day and time.

  utcoffset()

    Return self.tzinfo.utcoffset(self).

  utctimetuple()

    Return UTC time tuple, compatible with time.localtime().

  weekday()

    Return the day of the week represented by the date. Monday == 0 … Sunday == 6