code: def extract_date_time(self, the_time_stamp):
          
          date_tokens = the_time_stamp[0:10].split('-')
          self.year = int(date_tokens[0])
          self.month = int(date_tokens[1])
          self.day = int(date_tokens[2])
  
          time_tokens = the_time_stamp[11:19].split(':')
          self.hour = int(time_tokens[0])
          self.minute = int(time_tokens[1])
          self.second = int(time_tokens[2])
  
          # right now only handles Indonesian Timezones
          tz_dict = {
              'WIB': 'Asia/Jakarta',
              'WITA': 'Asia/Makassar',
              'WIT': 'Asia/Jayapura'
          }
          if self.time_zone in tz_dict:
              self.time_zone = tz_dict.get(self.time_zone, self.time_zone)
  
          # noinspection PyBroadException
          try:
              if not self.time_zone:
                  # default to utc if empty
                  tzinfo = pytz.utc
              else:
                  tzinfo = timezone(self.time_zone)
          except BaseException:
              tzinfo = pytz.utc
  
          self.time = datetime(
              self.year,
              self.month,
              self.day,
              self.hour,
              self.minute,
              self.second)
          # For now realtime always uses Western Indonesia Time
          self.time = tzinfo.localize(self.time)
docs: Extract the parts of a date given a timestamp as per below example.
  
          :param the_time_stamp: The 'event_timestamp' attribute from  grid.xml.
          :type the_time_stamp: str
  
          # now separate out its parts
          # >>> e = "2012-08-07T01:55:12WIB"
          #>>> e[0:10]
          #'2012-08-07'
          #>>> e[12:-3]
          #'01:55:11'
          #>>> e[-3:]
          #'WIB'   (WIB = Western Indonesian Time)