Code example for SimpleDateFormat

Methods: toPattern

0
 
    final DateFormat dateFormat = DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale);
    if (dateFormat instanceof SimpleDateFormat)
    { 
      this.dateFormat = (SimpleDateFormat) dateFormat;
      this.pattern = this.dateFormat.toPattern();
    } 
    else 
    { 
      // this should not happen in Sun JDKs, but you never know how the implementation looks like .. 
      final ResourceBundle datePatterns = ResourceBundle.getBundle
          ("org.pentaho.reporting.libraries.formatting.format-patterns"); 
 
      final String dateText;
      switch (dateStyle)
      { 
        case DateFormat.SHORT:
        { 
          dateText = datePatterns.getString("format.date.short");
          break; 
        }