Example usage for org.apache.poi.xssf.usermodel XSSFCellStyle getDataFormat

List of usage examples for org.apache.poi.xssf.usermodel XSSFCellStyle getDataFormat

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFCellStyle getDataFormat.

Prototype

@Override
public short getDataFormat() 

Source Link

Document

Get the index of the number format (numFmt) record used by this cell format.

Usage

From source file:com.adanac.excel.reader.sax.ExcelXSSFSheetXMLHandler.java

License:Apache License

@Override
@SuppressWarnings("unused")
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {

    if (isTextTag(name)) {
        vIsOpen = true;/*from   w  w w. jav a  2s  .  com*/
        // Clear contents cache
        value.setLength(0);
    } else if ("is".equals(name)) {
        // Inline string outer tag
        isIsOpen = true;
    } else if ("f".equals(name)) {
        // Clear contents cache
        formula.setLength(0);

        // Mark us as being a formula if not already
        if (nextDataType == xssfDataType.NUMBER) {
            nextDataType = xssfDataType.FORMULA;
        }

        // Decide where to get the formula string from
        String type = attributes.getValue("t");
        if (type != null && type.equals("shared")) {
            // Is it the one that defines the shared, or uses it?
            String ref = attributes.getValue("ref");
            String si = attributes.getValue("si");

            if (ref != null) {
                // This one defines it
                // TODO Save it somewhere
                fIsOpen = true;
            } else {
                // This one uses a shared formula
                // TODO Retrieve the shared formula and tweak it to
                // match the current cell
                if (formulasNotResults) {
                    logger.log(POILogger.WARN, "shared formulas not yet supported!");
                } else {
                    // It's a shared formula, so we can't get at the formula
                    // string yet
                    // However, they don't care about the formula string, so
                    // that's ok!
                }
            }
        } else {
            fIsOpen = true;
        }
    } else if ("oddHeader".equals(name) || "evenHeader".equals(name) || "firstHeader".equals(name)
            || "firstFooter".equals(name) || "oddFooter".equals(name) || "evenFooter".equals(name)) {
        hfIsOpen = true;
        // Clear contents cache
        headerFooter.setLength(0);
    } else if ("row".equals(name)) {
        String rowNumStr = attributes.getValue("r");
        if (rowNumStr != null) {
            rowNum = Integer.parseInt(rowNumStr) - 1;
        } else {
            rowNum = nextRowNum;
        }
        output.startRow(rowNum);
    }
    // c => cell
    else if ("c".equals(name)) {
        // Set up defaults.
        this.nextDataType = xssfDataType.NUMBER;
        this.formatIndex = -1;
        this.formatString = null;
        cellRef = attributes.getValue("r");
        String cellType = attributes.getValue("t");
        String cellStyleStr = attributes.getValue("s");
        if ("b".equals(cellType))
            nextDataType = xssfDataType.BOOLEAN;
        else if ("e".equals(cellType))
            nextDataType = xssfDataType.ERROR;
        else if ("inlineStr".equals(cellType))
            nextDataType = xssfDataType.INLINE_STRING;
        else if ("s".equals(cellType))
            nextDataType = xssfDataType.SST_STRING;
        else if ("str".equals(cellType))
            nextDataType = xssfDataType.FORMULA;
        else {
            // Number, but almost certainly with a special style or format
            XSSFCellStyle style = null;
            if (cellStyleStr != null) {
                int styleIndex = Integer.parseInt(cellStyleStr);
                style = stylesTable.getStyleAt(styleIndex);
            } else if (stylesTable.getNumCellStyles() > 0) {
                style = stylesTable.getStyleAt(0);
            }
            if (style != null) {
                this.formatIndex = style.getDataFormat();
                this.formatString = style.getDataFormatString();
                if (this.formatString == null || this.formatString.startsWith("reserved-0x"))
                    this.formatString = ExcelBuiltinFormats.getBuiltinFormat(this.formatIndex);
            }
        }
    }
}

From source file:com.myjeeva.poi.CustomXSSFSheetXMLHandler.java

License:Apache License

public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {

    if (isTextTag(name)) {
        vIsOpen = true;//from w w w .ja va  2 s. c  om
        // Clear contents cache
        value.setLength(0);
    } else if ("is".equals(name)) {
        // Inline string outer tag
        isIsOpen = true;
    } else if ("f".equals(name)) {
        // Clear contents cache
        formula.setLength(0);

        // Mark us as being a formula if not already
        if (nextDataType == xssfDataType.NUMBER) {
            nextDataType = xssfDataType.FORMULA;
        }

        // Decide where to get the formula string from
        String type = attributes.getValue("t");
        if (type != null && type.equals("shared")) {
            // Is it the one that defines the shared, or uses it?
            String ref = attributes.getValue("ref");
            String si = attributes.getValue("si");

            if (ref != null) {
                // This one defines it
                // TODO Save it somewhere
                fIsOpen = true;
            } else {
                // This one uses a shared formula
                // TODO Retrieve the shared formula and tweak it to
                //  match the CURRENT cell
                if (formulasNotResults) {
                    System.err.println("Warning - shared formulas not yet supported!");
                } else {
                    // It's a shared formula, so we can't get at the formula string yet
                    // However, they don't care about the formula string, so that's ok!
                }
            }
        } else {
            fIsOpen = true;
        }
    } else if ("oddHeader".equals(name) || "evenHeader".equals(name) || "firstHeader".equals(name)
            || "firstFooter".equals(name) || "oddFooter".equals(name) || "evenFooter".equals(name)) {
        hfIsOpen = true;
        // Clear contents cache
        headerFooter.setLength(0);
    } else if ("row".equals(name)) {
        int rowNum = Integer.parseInt(attributes.getValue("r")) - 1;
        output.startRow(rowNum);
    }
    // c => cell
    else if ("c".equals(name)) {
        // Set up defaults.
        this.nextDataType = xssfDataType.NUMBER;
        this.formatIndex = -1;
        this.formatString = null;
        cellRef = attributes.getValue("r");
        String cellType = attributes.getValue("t");
        String cellStyleStr = attributes.getValue("s");
        if ("b".equals(cellType))
            nextDataType = xssfDataType.BOOLEAN;
        else if ("e".equals(cellType))
            nextDataType = xssfDataType.ERROR;
        else if ("inlineStr".equals(cellType))
            nextDataType = xssfDataType.INLINE_STRING;
        else if ("s".equals(cellType))
            nextDataType = xssfDataType.SST_STRING;
        else if ("str".equals(cellType))
            nextDataType = xssfDataType.FORMULA;
        else if (cellStyleStr != null) {
            // Number, but almost certainly with a special style or format
            int styleIndex = Integer.parseInt(cellStyleStr);
            XSSFCellStyle style = stylesTable.getStyleAt(styleIndex);
            this.formatIndex = style.getDataFormat();
            this.formatString = style.getDataFormatString();
            if (this.formatString == null)
                this.formatString = BuiltinFormats.getBuiltinFormat(this.formatIndex);
        }
    }
}

From source file:com.ostrichemulators.semtool.poi.main.xlsxml.LoadingSheetXmlHandler.java

@Override
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
    if (null != name) {
        switch (name) {
        case "row":
            rownum = Integer.parseInt(attributes.getValue("r")) - 1;
            currentrowdata.clear();/*from  w w w  .  j  av a2 s  . co m*/
            break;
        case "c": // c is a new cell
            String celltypestr = attributes.getValue("t");
            celltype = (formats.containsKey(celltypestr) ? formats.get(celltypestr) : CellType.BLANK);
            // dates don't always have a type attribute
            if (CellType.NUMERIC == celltype || null == celltypestr) {
                celltype = CellType.NUMERIC;

                // check if it's a date
                String styleidstr = attributes.getValue("s");
                int styleid = (null == styleidstr ? 0 : Integer.parseInt(styleidstr));

                XSSFCellStyle style = styles.getStyleAt(styleid);
                int formatIndex = style.getDataFormat();
                String formatString = style.getDataFormatString();
                isdate = DateUtil.isADateFormat(formatIndex, formatString);
            }

            String colname = attributes.getValue("r");
            colnum = getColNum(colname.substring(0, colname.lastIndexOf(Integer.toString(rownum + 1))));
            break;
        case "v": // new value for a cell
            setReading(true);
            resetContents();
            break;
        }
    }
}

From source file:com.teradata.demo.utils.excel.XSSFSheetXMLHandler.java

License:Apache License

public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {

    if (isTextTag(name)) {
        vIsOpen = true;//from   w ww  . j  a va 2 s.c om
        // Clear contents cache
        value.setLength(0);
    } else if ("is".equals(name)) {
        // Inline string outer tag
        isIsOpen = true;
    } else if ("f".equals(name)) {
        // Clear contents cache
        formula.setLength(0);

        // Mark us as being a formula if not already
        if (nextDataType == xssfDataType.NUMBER) {
            nextDataType = xssfDataType.FORMULA;
        }

        // Decide where to get the formula string from
        String type = attributes.getValue("t");
        if (type != null && type.equals("shared")) {
            // Is it the one that defines the shared, or uses it?
            String ref = attributes.getValue("ref");
            String si = attributes.getValue("si");

            if (ref != null) {
                // This one defines it
                // TODO Save it somewhere
                fIsOpen = true;
            } else {
                // This one uses a shared formula
                // TODO Retrieve the shared formula and tweak it to 
                //  match the current cell
                if (formulasNotResults) {
                    System.err.println("Warning - shared formulas not yet supported!");
                } else {
                    // It's a shared formula, so we can't get at the formula string yet
                    // However, they don't care about the formula string, so that's ok!
                }
            }
        } else {
            fIsOpen = true;
        }
    } else if ("oddHeader".equals(name) || "evenHeader".equals(name) || "firstHeader".equals(name)
            || "firstFooter".equals(name) || "oddFooter".equals(name) || "evenFooter".equals(name)) {
        hfIsOpen = true;
        // Clear contents cache
        headerFooter.setLength(0);
    } else if ("row".equals(name)) {
        int rowNum = Integer.parseInt(attributes.getValue("r")) - 1;
        output.startRow(rowNum);
    }
    // c => cell
    else if ("c".equals(name)) {
        // Set up defaults.
        this.nextDataType = xssfDataType.NUMBER;
        this.formatIndex = -1;
        this.formatString = null;
        cellRef = attributes.getValue("r");

        String cellType = attributes.getValue("t");
        String cellStyleStr = attributes.getValue("s");
        if ("b".equals(cellType))
            nextDataType = xssfDataType.BOOLEAN;
        else if ("e".equals(cellType))
            nextDataType = xssfDataType.ERROR;
        else if ("inlineStr".equals(cellType))
            nextDataType = xssfDataType.INLINE_STRING;
        else if ("s".equals(cellType))
            nextDataType = xssfDataType.SST_STRING;
        else if ("str".equals(cellType))
            nextDataType = xssfDataType.FORMULA;
        else if (cellStyleStr != null) {
            // Number, but almost certainly with a special style or format
            int styleIndex = Integer.parseInt(cellStyleStr);
            XSSFCellStyle style = stylesTable.getStyleAt(styleIndex);
            this.formatIndex = style.getDataFormat();
            this.formatString = style.getDataFormatString();
            if (this.formatString == null)
                this.formatString = BuiltinFormats.getBuiltinFormat(this.formatIndex);
        }
    }
}

From source file:net.geoprism.data.etl.excel.XSSFSheetXMLHandler.java

License:Open Source License

public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {

    if (isTextTag(name)) {
        vIsOpen = true;/*  w  ww  .j  a v  a2s . c  o m*/
        // Clear contents cache
        value.setLength(0);
    } else if ("is".equals(name)) {
        // Inline string outer tag
        isIsOpen = true;
    } else if ("f".equals(name)) {
        // Clear contents cache
        formula.setLength(0);

        // Mark us as being a formula if not already
        if (nextDataType == ColumnType.NUMBER) {
            nextDataType = ColumnType.FORMULA;
        }

        // Decide where to get the formula string from
        String type = attributes.getValue("t");
        if (type != null && type.equals("shared")) {
            // Is it the one that defines the shared, or uses it?
            String ref = attributes.getValue("ref");
            String si = attributes.getValue("si");

            if (ref != null) {
                // This one defines it
                // TODO Save it somewhere
                fIsOpen = true;
            } else {
                // This one uses a shared formula
                // TODO Retrieve the shared formula and tweak it to
                // match the current cell
                if (formulasNotResults) {
                    System.err.println("Warning - shared formulas not yet supported!");
                } else {
                    // It's a shared formula, so we can't get at the formula string yet
                    // However, they don't care about the formula string, so that's ok!
                }
            }
        } else {
            fIsOpen = true;
        }
    } else if ("oddHeader".equals(name) || "evenHeader".equals(name) || "firstHeader".equals(name)
            || "firstFooter".equals(name) || "oddFooter".equals(name) || "evenFooter".equals(name)) {
        hfIsOpen = true;
        // Clear contents cache
        headerFooter.setLength(0);
    } else if ("row".equals(name)) {
        int rowNum = Integer.parseInt(attributes.getValue("r")) - 1;
        output.startRow(rowNum);
    }
    // c => cell
    else if ("c".equals(name)) {
        // Set up defaults.
        this.nextDataType = ColumnType.NUMBER;
        this.formatIndex = -1;
        this.formatString = null;
        cellRef = attributes.getValue("r");
        String cellType = attributes.getValue("t");
        String cellStyleStr = attributes.getValue("s");
        if ("b".equals(cellType))
            nextDataType = ColumnType.BOOLEAN;
        else if ("e".equals(cellType))
            nextDataType = ColumnType.ERROR;
        else if ("inlineStr".equals(cellType))
            nextDataType = ColumnType.INLINE_STRING;
        else if ("s".equals(cellType))
            nextDataType = ColumnType.TEXT;
        else if ("str".equals(cellType))
            nextDataType = ColumnType.FORMULA;
        else if (cellStyleStr != null) {
            // Number, but almost certainly with a special style or format
            int styleIndex = Integer.parseInt(cellStyleStr);
            XSSFCellStyle style = stylesTable.getStyleAt(styleIndex);
            this.formatIndex = style.getDataFormat();
            this.formatString = style.getDataFormatString();
            if (this.formatString == null)
                this.formatString = BuiltinFormats.getBuiltinFormat(this.formatIndex);
        }
    }
}

From source file:org.addition.epanet.network.io.input.ExcelParser.java

License:Open Source License

private void findTimeStyle(XSSFWorkbook workbook) {
    final List<Short> validTimeFormats = Arrays.asList(new Short[] { 0x12, // "h:mm AM/PM"
            0x13, // "h:mm:ss AM/PM"
            0x14, // "h:mm"
            0x15, // "h:mm:ss"
            0x16, // "m/d/yy h:mm"
            0x2d, // "mm:ss"
            0x2e, // "[h]:mm:ss"
            0x2f, // "mm:ss.0"
    });//from   w  w  w . j  ava  2 s  .c om

    StylesTable styleTable = workbook.getStylesSource();
    int stylesCount = styleTable.getNumCellStyles();
    for (int i = 0; i < stylesCount; i++) {
        XSSFCellStyle style = styleTable.getStyleAt(i);

        //if(org.apache.poi.ss.usermodel.DateUtil.isInternalDateFormat(style.getDataFormat()))
        if (validTimeFormats.contains(style.getDataFormat()))
            timeStyles.add(style);
        else if (style.getDataFormatString().toLowerCase().contains("[h]:mm")
                || style.getDataFormatString().toLowerCase().contains("[hh]:mm"))
            timeStyles.add(style);
    }
}

From source file:org.apache.metamodel.excel.XlsxSheetToRowsHandler.java

License:Apache License

@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
    if ("row".equals(qName)) {
        // element is a row

        // excel row numbers are 1-based
        int rowNumber = Integer.parseInt(attributes.getValue("r"));
        rowNumber = rowNumber - 1;/*ww  w  .j a  v  a  2s.  co m*/

        if (_configuration.isSkipEmptyLines()) {
            _rowNumber++;
        } else {
            while (_rowNumber + 1 < rowNumber) {
                // empty lines are not skipped, so dispatch empty lines
                _rowNumber++;
                List<String> emptyValues = Collections.emptyList();
                List<Style> emptyStyles = Collections.emptyList();
                _callback.row(_rowNumber, emptyValues, emptyStyles);
            }
            _rowNumber = rowNumber;
        }
    } else if ("c".equals(qName)) {
        // element is a cell

        _inCell = true;

        final String r = attributes.getValue("r");
        int firstDigit = -1;
        for (int c = 0; c < r.length(); ++c) {
            if (Character.isDigit(r.charAt(c))) {
                firstDigit = c;
                break;
            }
        }
        _columnNumber = nameToColumn(r.substring(0, firstDigit));

        // Set up defaults.
        _dataType = XssfDataType.NUMBER;
        _formatIndex = -1;
        _formatString = null;

        final String cellType = attributes.getValue("t");
        if ("b".equals(cellType)) {
            _dataType = XssfDataType.BOOL;
        } else if ("e".equals(cellType)) {
            _dataType = XssfDataType.ERROR;
        } else if ("inlineStr".equals(cellType)) {
            _dataType = XssfDataType.INLINESTR;
        } else if ("s".equals(cellType)) {
            _dataType = XssfDataType.SSTINDEX;
        } else if ("str".equals(cellType)) {
            _dataType = XssfDataType.FORMULA;
        }

        String cellStyleStr = attributes.getValue("s");
        if (cellStyleStr != null) {
            // It's a number, but almost certainly one
            // with a special style or format
            int styleIndex = Integer.parseInt(cellStyleStr);
            XSSFCellStyle style = _stylesTable.getStyleAt(styleIndex);

            configureStyle(style);

            if (_dataType == XssfDataType.NUMBER) {
                this._formatIndex = style.getDataFormat();
                this._formatString = style.getDataFormatString();
                if (this._formatString == null) {
                    this._formatString = BuiltinFormats.getBuiltinFormat(this._formatIndex);
                }
            }
        }
    } else if (_inCell && "f".equals(qName)) {
        // skip the actual formula line
        _inFormula = true;
    }
}

From source file:org.bbreak.excella.core.test.util.TestUtil.java

License:Open Source License

private static String getCellStyleString(XSSFCellStyle cellStyle) {
    StringBuffer sb = new StringBuffer();
    if (cellStyle != null) {
        XSSFFont font = cellStyle.getFont();
        sb.append("Font=").append(font.getCTFont()).append(",");
        sb.append("DataFormat=").append(cellStyle.getDataFormat()).append(",");
        sb.append("DataFormatString=").append(cellStyle.getDataFormatString()).append(",");
        sb.append("Hidden=").append(cellStyle.getHidden()).append(",");
        sb.append("Locked=").append(cellStyle.getLocked()).append(",");
        sb.append("Alignment=").append(cellStyle.getAlignmentEnum()).append(",");
        sb.append("WrapText=").append(cellStyle.getWrapText()).append(",");
        sb.append("VerticalAlignment=").append(cellStyle.getVerticalAlignmentEnum()).append(",");
        sb.append("Rotation=").append(cellStyle.getRotation()).append(",");
        sb.append("Indention=").append(cellStyle.getIndention()).append(",");
        sb.append("BorderLeft=").append(cellStyle.getBorderLeftEnum()).append(",");
        sb.append("BorderRight=").append(cellStyle.getBorderRightEnum()).append(",");
        sb.append("BorderTop=").append(cellStyle.getBorderTopEnum()).append(",");
        sb.append("BorderBottom=").append(cellStyle.getBorderBottomEnum()).append(",");

        sb.append("LeftBorderColor=").append(getXSSFColorString(cellStyle.getLeftBorderXSSFColor()))
                .append(",");
        sb.append("RightBorderColor=").append(getXSSFColorString(cellStyle.getRightBorderXSSFColor()))
                .append(",");
        sb.append("TopBorderColor=").append(getXSSFColorString(cellStyle.getTopBorderXSSFColor())).append(",");
        sb.append("BottomBorderColor=").append(getXSSFColorString(cellStyle.getBottomBorderXSSFColor()))
                .append(",");

        sb.append("FillPattern=").append(cellStyle.getFillPatternEnum()).append(",");
        sb.append("FillForegroundColor=").append(getXSSFColorString(cellStyle.getFillForegroundXSSFColor()))
                .append(",");
        sb.append("FillBackgroundColor=").append(getXSSFColorString(cellStyle.getFillBackgroundXSSFColor()));
    }//w  ww.ja  va 2s.  c o m
    return sb.toString();
}

From source file:org.bbreak.excella.reports.ReportsTestUtil.java

License:Open Source License

/**
 * XSSF????//from  w w w  . j  av  a 2s  .  c o  m
 * 
 * @param cellStyle 
 * @return ??
 */
private static String getCellStyleString(XSSFCellStyle cellStyle) {
    StringBuffer sb = new StringBuffer();
    if (cellStyle != null) {
        XSSFFont font = cellStyle.getFont();
        sb.append("Font=").append(font.getCTFont()).append(",");
        sb.append("DataFormat=").append(cellStyle.getDataFormat()).append(",");
        sb.append("DataFormatString=").append(cellStyle.getDataFormatString()).append(",");
        sb.append("Hidden=").append(cellStyle.getHidden()).append(",");
        sb.append("Locked=").append(cellStyle.getLocked()).append(",");
        sb.append("Alignment=").append(cellStyle.getAlignmentEnum()).append(",");
        sb.append("WrapText=").append(cellStyle.getWrapText()).append(",");
        sb.append("VerticalAlignment=").append(cellStyle.getVerticalAlignmentEnum()).append(",");
        sb.append("Rotation=").append(cellStyle.getRotation()).append(",");
        sb.append("Indention=").append(cellStyle.getIndention()).append(",");
        sb.append("BorderLeft=").append(cellStyle.getBorderLeftEnum()).append(",");
        sb.append("BorderRight=").append(cellStyle.getBorderRightEnum()).append(",");
        sb.append("BorderTop=").append(cellStyle.getBorderTopEnum()).append(",");
        sb.append("BorderBottom=").append(cellStyle.getBorderBottomEnum()).append(",");

        sb.append("LeftBorderColor=").append(getXSSFColorString(cellStyle.getLeftBorderXSSFColor()))
                .append(",");
        sb.append("RightBorderColor=").append(getXSSFColorString(cellStyle.getRightBorderXSSFColor()))
                .append(",");
        sb.append("TopBorderColor=").append(getXSSFColorString(cellStyle.getTopBorderXSSFColor())).append(",");
        sb.append("BottomBorderColor=").append(getXSSFColorString(cellStyle.getBottomBorderXSSFColor()))
                .append(",");

        sb.append("FillPattern=").append(cellStyle.getFillPatternEnum()).append(",");
        try {
            sb.append("FillForegroundColor=").append(getXSSFColorString(cellStyle.getFillForegroundXSSFColor()))
                    .append(",");
        } catch (NullPointerException e) {
            // POI-3.7???
            sb.append("FillForegroundColor=none,");
        }

        try {
            sb.append("FillBackgroundColor=")
                    .append(getXSSFColorString(cellStyle.getFillBackgroundXSSFColor()));
        } catch (NullPointerException e) {
            // POI-3.7???
            sb.append("FillBackgroundColor=none,");
        }
    }
    return sb.toString();
}

From source file:org.exoplatform.services.document.impl.MSXExcelDocumentReader.java

License:Open Source License

public static boolean isCellDateFormatted(XSSFCell cell) {
    boolean bDate = false;
    double d = cell.getNumericCellValue();
    if (HSSFDateUtil.isValidExcelDate(d)) {
        XSSFCellStyle style = cell.getCellStyle();
        int i = style.getDataFormat();
        switch (i) {
        case 0xe: // m/d/yy
        case 0xf: // d-mmm-yy
        case 0x10: // d-mmm
        case 0x11: // mmm-yy
        case 0x12: // h:mm AM/PM
        case 0x13: // h:mm:ss AM/PM
        case 0x14: // h:mm
        case 0x15: // h:mm:ss
        case 0x16: // m/d/yy h:mm
        case 0x2d: // mm:ss
        case 0x2e: // [h]:mm:ss
        case 0x2f: // mm:ss.0

        case 0xa5: // ??
        case 0xa7: // ??
        case 0xa9: // ??

        case 0xac: // mm:dd:yy not specified in javadoc
        case 0xad: // yyyy-mm-dd not specified in javadoc
        case 0xae: // mm:dd:yyyy not specified in javadoc
        case 0xaf: // m:d:yy not specified in javadoc
            bDate = true;/*  w  w  w.  ja v  a 2 s. co m*/
            break;
        default:
            bDate = false;
            break;
        }
    }
    return bDate;
}