code: def asDateTime(self):
          
          text = str(self)
          if text.endswith('Z'):
              tzinfo = TimeMixIn.UTC
              text = text[:-1]
  
          elif '-' in text or '+' in text:
              if '+' in text:
                  text, plusminus, tz = string.partition(text, '+')
              else:
                  text, plusminus, tz = string.partition(text, '-')
  
              if self._shortTZ and len(tz) == 2:
                  tz += '00'
  
              if len(tz) != 4:
                  raise error.PyAsn1Error('malformed time zone offset %s' % tz)
  
              try:
                  minutes = int(tz[:2]) * 60 + int(tz[2:])
                  if plusminus == '-':
                      minutes *= -1
  
              except ValueError:
                  raise error.PyAsn1Error('unknown time specification %s' % self)
  
              tzinfo = TimeMixIn.FixedOffset(minutes, '?')
  
          else:
              tzinfo = None
  
          if '.' in text or ',' in text:
              if '.' in text:
                  text, _, ms = string.partition(text, '.')
              else:
                  text, _, ms = string.partition(text, ',')
  
              try:
                  ms = int(ms) * 1000
  
              except ValueError:
                  raise error.PyAsn1Error('bad sub-second time specification %s' % self)
  
          else:
              ms = 0
  
          if self._optionalMinutes and len(text) - self._yearsDigits == 6:
              text += '0000'
          elif len(text) - self._yearsDigits == 8:
              text += '00'
  
          try:
              dt = dateandtime.strptime(text, self._yearsDigits == 4 and '%Y%m%d%H%M%S' or '%y%m%d%H%M%S')
  
          except ValueError:
              raise error.PyAsn1Error('malformed datetime format %s' % self)
  
          return dt.replace(microsecond=ms, tzinfo=tzinfo)
docs: Create :py:class:`datetime.datetime` object from a |ASN.1| object.
  
          Returns
          -------
          :
              new instance of :py:class:`datetime.datetime` object