code: def parse_date(string, force_datetime=False):
      
      matches = DATE.match(string)
      if not matches:
          return None
  
      values = dict([
          (
              k,
              v if v[0] in '+-' else int(v)
          ) for k,v in matches.groupdict().items() if v and int(v)
      ])
  
      if 'timestamp' in values:
          value = datetime.datetime.utcfromtimestamp(0) + datetime.timedelta(
              hours=int(values.get('offset_h', 0)),
              minutes=int(values.get('offset_m', 0)),
              seconds=int(values['timestamp']) / 1000.0
          )
          return value
  
      # I've made an assumption here, that a DateTime value will not
      # ever be YYYY-MM-DDT00:00:00, which is probably bad. I'm not
      # really sure how to handle this, other than to hard-code the
      # names of the field that are actually Date rather than DateTime.
      if len(values) > 3 or force_datetime:
          return datetime.datetime(**values)
  
      # Sometimes Xero returns Date(0+0000), so we end up with no
      # values. Return None for this case
      if not values:
          return None
  
      return datetime.date(**values)
docs: Takes a Xero formatted date, e.g. /Date(1426849200000+1300)/