pyds.DateTime

class pyds.DateTime(year, month, day, hour, minute, second=None, utc=False, zone_hour=None, zone_minute=None)

Bases: pyds.Scalar

Represents a PDS date-time value.

Parameters
  • year (int)

  • month (None or int)

    If None, then day is interperated as the day of the year instead of as the day of the month, and Date serialized in ‘day-of-year’ format.

  • day (int)

    The day of the month if month is not None. Otherwise it’s the day of the year.

  • hour (int)

  • minute (int)

  • second (None or float)

  • utc (True or False)

    Whether the time is in UTC or not.

  • zone_hour (None or int)

    If utc is True and zone_hour is not None, zone_hour is stored, but when Time is serialized, it’s serialized ignoring zone_hour.

  • zone_minute (None or int)

Raises

ValueError

  • If month is not None and not between 1 and 12.
  • If month is not None and day is not between 1 and the number of days in the month month.
  • If month is None and day is not between 1 and the number of days in the year year (365 or 366 depending on if it’s a leap year).
  • If hour is not between 0 and 23.
  • If minute is not between 0 and 59.
  • If second is not None and not between 0 and 59.
  • If zone_hour is not None and not between -12 and 12.
  • If zone_hour is not None and zone_minute is not between 0 and 59.
Attributes
date

Instance of Date. Read-only.

time

Instance of Time. Read-only.


Special Methods

DateTime.__str__()

Return a PDS serialized string (str) representing the object.

Called by str().