List of usage examples for com.google.gwt.i18n.shared.impl DateRecord setMonth
@Override public void setMonth(int month)
From source file:com.rnb.plategka.shared.DateTimeFormat.java
License:Apache License
/** * Parses Month field./*www . ja va2s . c o m*/ * * @param text * the time text to be parsed * @param pos * Parse position * @param cal * DateRecord object that will hold parsed value * @param value * numeric value if this field is expressed using numberic * pattern * @param start * from where parse start * * @return <code>true</code> if parsing successful */ private boolean subParseMonth(String text, int[] pos, DateRecord cal, int value, int start) { // When month is symbols, i.e., MMM or MMMM, value will be -1. if (value < 0) { // Want to be able to parse both short and long forms. // Try count == 4 first: value = matchString(text, start, dateTimeFormatInfo.monthsFull(), pos); if (value < 0) { // count == 4 failed, now try count == 3. value = matchString(text, start, dateTimeFormatInfo.monthsShort(), pos); } if (value < 0) { return false; } cal.setMonth(value); return true; } else if (value > 0) { cal.setMonth(value - 1); return true; } return false; }
From source file:com.rnb.plategka.shared.DateTimeFormat.java
License:Apache License
/** * Parses a standalone month field.//from w ww . j a v a2 s. c om * * @param text * the time text to be parsed * @param pos * Parse position * @param cal * DateRecord object that will hold parsed value * @param value * numeric value if this field is expressed using numberic * pattern * @param start * from where parse start * * @return <code>true</code> if parsing successful */ private boolean subParseStandaloneMonth(String text, int[] pos, DateRecord cal, int value, int start) { // When month is symbols, i.e., LLL or LLLL, value will be -1. if (value < 0) { // Want to be able to parse both short and long forms. // Try count == 4 first: value = matchString(text, start, dateTimeFormatInfo.monthsFullStandalone(), pos); if (value < 0) { // count == 4 failed, now try count == 3. value = matchString(text, start, dateTimeFormatInfo.monthsShortStandalone(), pos); } if (value < 0) { return false; } cal.setMonth(value); return true; } else if (value > 0) { cal.setMonth(value - 1); return true; } return false; }