Package com.ibm.icu.text

Examples of com.ibm.icu.text.DateFormat.format()


     */
    public void testGetDateTimeFormatIntIntULocale() {
        Calendar cal = Calendar.getInstance();
        cal.set(1990, 8, 16, 20, 3);
        DateFormat df = cal.getDateTimeFormat(DateFormat.LONG, DateFormat.SHORT, ULocale.US);
        assertEquals("September 16, 1990 8:03 PM", df.format(cal));
    }

    /*
     * Test method for 'com.ibm.icu.util.Calendar.fieldDifference(Date, int)'
     */
 
View Full Code Here


       
        if (pattern != null && pattern.length() != 0 && dateFormat instanceof SimpleDateFormat) {
            ((SimpleDateFormat)dateFormat).applyPattern(pattern);
        }
       
        return dateFormat.format(t.toDate());
    }

    /**
     * Parses a time value from a string using the pattern specified.
     * @throws ParseException
View Full Code Here

    @Override
    public String getTextValue() {
        DateFormat fmt=DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.LONG);
        fmt.setTimeZone(TimeZone.getDefault());

        return fmt.format(timeValue.toDate());
    }

    /**
     * Return an input policy which describes how to marshall a value represented
     * by a value node from Java to CAL.
View Full Code Here

     * @return a formatted string representing the date value stored in this node
     */
    protected String getTextValue(int dateStyle, int timeStyle) {

        DateFormat dateFormat = getDateFormat(dateStyle, timeStyle);
        return dateFormat.format(getJavaDate());

    }

}
View Full Code Here

            DateFormat dateFormat = RelativeTemporalValueNode.getDateFormat(DateFormat.FULL, -1);
           
            try {
                dateFormat.parse(currentText);
            } catch (ParseException pe) {
                currentText = dateFormat.format(dateValueNode.getDateValue());
                changed = true;

            }

        } else if (typeExpr.isNonParametricType(CAL_RelativeTime.TypeConstructors.RelativeTime)) {
View Full Code Here

            DateFormat timeFormat = RelativeTemporalValueNode.getDateFormat(-1, DateFormat.MEDIUM);
           
            try {
                timeFormat.parse(currentText);
            } catch (ParseException pe) {
                currentText = timeFormat.format(timeValueNode.getTimeValue());
                changed = true;

            }

        } else if (typeExpr.isNonParametricType(CAL_RelativeTime.TypeConstructors.RelativeDateTime)) {
View Full Code Here

            DateFormat dateTimeFormat = RelativeTemporalValueNode.getDateFormat(DateFormat.FULL, DateFormat.MEDIUM);
           
            try {
                dateTimeFormat.parse(currentText);
            } catch (ParseException pe) {
                currentText = dateTimeFormat.format(dateTimeValueNode.getDateTimeValue());
                changed = true;
            }

        } else if (typeExpr.isNonParametricType(CAL_Time.TypeConstructors.Time)) {
View Full Code Here

           
            try {
                fmt.parse(currentText);
            } catch (ParseException pe) {
                currentText = fmt.format(valueNode.getJavaDate());
                changed = true;
            }

        } else if (typeExpr.sameType(typeConstants.getCharListType())) {
View Full Code Here

   * @return the date only
   */
  public String getDateOnly(final Date date) {
    DateFormat df = getDateOnlyFormat();
    synchronized (df) {
      return df.format(date);
    }
  }

  /**
   * Gets the time only.
View Full Code Here

   * @return the time only
   */
  public String getTimeOnly(final Date date) {
    DateFormat df = getTimeOnlyFormat();
    synchronized (df) {
      return df.format(date);
    }
  }

  /**
   * Gets the date time.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.