code: def datetime_f(dttm):
      
      if dttm:
          dttm = dttm.isoformat()
          now_iso = datetime.now().isoformat()
          if now_iso[:10] == dttm[:10]:
              dttm = dttm[11:]
          elif now_iso[:4] == dttm[:4]:
              dttm = dttm[5:]
      return '<nobr>{}</nobr>'.format(dttm)
docs: Formats datetime to take less room when it is recent