code: public static String formatDate(Date date, String mask) {
          if (date == null) {
              return "";
          }
  
          if (mask == null) {
              mask = DATE_FORMAT;
          }
  
          return new SimpleDateFormat(mask).format(date);
      }
docs: /* DATE FORMAT FUNCTIONS