Examples of DateFormat


Examples of Framework.DateFormat

    /**
     * @param date
     * @return
     */
    public String toStringDate(DateTimeData date) {
        DateFormat gmtfmt = new DateFormat();
        gmtfmt.setTemplate("ddd, dd mmm yyyy hh:mm:ss GMT");
        return gmtfmt.formatDate(date).toString();
    }
View Full Code Here

Examples of com.ctlok.springframework.web.servlet.view.rythm.tag.DateFormat

       
        tags.add(new Url());
        tags.add(new FullUrl());
        tags.add(new Message(getApplicationContext()));
        tags.add(new Secured());
        tags.add(new DateFormat());
        tags.add(new CookieValue());
        tags.add(new CsrfToken(configurator.getCsrfTokenGenerator(),
                configurator.getCsrfTokenSessionName()));
       
        return tags;
View Full Code Here

Examples of com.google.gwt.visualization.client.formatters.DateFormat

        Options options;
       
        options = Options.create();
        options.setPattern(FormatType.LONG);
        options.setTimeZone(2);
        DateFormat formatter = DateFormat.create(options);
        formatter.format(dataTable, 1);
        formatter.format(dataTable, 2);
        assertEquals("March 11, 2005", dataTable.getFormattedValue(0, 1));
        assertEquals("February 16, 2009 1:00:00 PM UTC+2",
                     dataTable.getFormattedValue(0, 2));
        // Verify that using a formatter on a column overrides all previously set
        // formatted-values.
        assertEquals("January 30, 2009 10:00:00 AM UTC+2",
                     dataTable.getFormattedValue(3, 2));

        // Test formatting date using pattern and timezone.
       
        options = Options.create();
        options.setPattern("dd/MM/yyyy");
        options.setTimeZone(2);
        formatter = DateFormat.create(options);
        formatter.format(dataTable, 1);
        assertEquals("11/03/2005", dataTable.getFormattedValue(0, 1));
        options = Options.create();
        options.setPattern("dd/MM/yyyy, HH:mm");
        options.setTimeZone(2);
        formatter = DateFormat.create(options);
        formatter.format(dataTable, 2);
        assertEquals("16/02/2009, 13:00", dataTable.getFormattedValue(0, 2));
      }
    });
  }
View Full Code Here

Examples of com.googlecode.gwt.charts.client.format.DateFormat

    }

    protected DataTable formatTable(DataTable gTable) {
        DateFormatOptions dateFormatOptions = DateFormatOptions.create();
        dateFormatOptions.setFormatType(FormatType.MEDIUM);
        DateFormat dateFormat = DateFormat.create(dateFormatOptions);

        NumberFormatOptions numberFormatOptions = NumberFormatOptions.create();
        numberFormatOptions.setPattern("#,###.##");
        NumberFormat numberFormat = NumberFormat.create(numberFormatOptions);

        for (int i = 0; i < gTable.getNumberOfColumns(); i++) {
            com.googlecode.gwt.charts.client.ColumnType type = gTable.getColumnType(i);
            if (com.googlecode.gwt.charts.client.ColumnType.DATE.equals(type)) {
                dateFormat.format(gTable, i);
            }
            else if (com.googlecode.gwt.charts.client.ColumnType.NUMBER.equals(type)) {
                numberFormat.format(gTable, i);
            }
        }
View Full Code Here

Examples of com.ibm.icu.text.DateFormat

     * Utility for formatting.
     */
    private static DateFormat formatHelper(Calendar cal, Locale loc, int dateStyle, int timeStyle) {
        // Assume there is only one kind of calendar.  In Java 6 there will also be Japanese
        // calendars, but we'll worry about that when it happens.
        DateFormat df = DateFormat.getDateTimeInstance(dateStyle, timeStyle, loc);
        df.setCalendar(cal);
        return df;
    }
View Full Code Here

Examples of com.jaxws.json.codec.DateFormat

      assert date != null;
     
      /*
       *  Step 5.4.1: check is custom date format annotation added.
       */
      DateFormat     currentFormat   = (customInfo != null && customInfo.format().length() > 0) ?
          DateFormat.CUSTOM : this.dateFormat;
       
      /*
       *  Step 5.4.2: serialize date based on format.
       */
      switch(currentFormat){
      case PLAIN:
        this.add(String.valueOf(date.getTime()));
        break;
      case CUSTOM:
        this.string(this.date2String(date,customInfo.format()));
        return;
      default:
        this.string(this.date2String(date,currentFormat.getFormat()));
      }
    }
View Full Code Here

Examples of java.text.DateFormat

  @Test
  public void testDateFormat_CustomMapType() throws Exception {
    // Test that date format works for mapping between String and Custom Map Type
    mapper = getMapper(new String[] { "mapMapping3.xml" });
    DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
    String dateStr = "10/15/2005";
    CustomMap src = newInstance(CustomMap.class);
    src.putValue("fieldA", dateStr);

    org.dozer.vo.SimpleObj dest = mapper.map(src, org.dozer.vo.SimpleObj.class);
    assertNotNull("dest field should not be null", dest.getField5());
    assertEquals("dest field contains wrong date value", df.parse(dateStr), dest.getField5().getTime());

    CustomMap remappedSrc = mapper.map(dest, CustomMap.class);
    assertEquals("remapped src field contains wrong date string", dateStr, remappedSrc.getValue("fieldA"));
  }
View Full Code Here

Examples of java.text.DateFormat

   */
  public ActionErrors validateDateString(String fieldLabel, String date, Locale locale, String errorKey, ActionErrors actionErrors)
  {
    Calendar calendar = new GregorianCalendar();
    calendar.setLenient(false);
    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
    try {
      Date parsedDate = df.parse(date);
      calendar.setTime(parsedDate);
    } catch (ParseException e) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel));
      actionErrors.add(errorKey, error);
    } catch (Exception e) {
View Full Code Here

Examples of java.text.DateFormat

      if (fieldValue != null) {
        fieldValue = fieldValue.trim();
      } else {
        isError = true;
      }
      DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT, locale);
      tf.parse(fieldValue);
      isError = false;
    } catch (Exception e) {
      isError = true;
    }
    if (isError) {
View Full Code Here

Examples of java.text.DateFormat

  public String  getDisplayString()
  {   
    System.out.println("In display Pure Time ** member string-----------------****");
    if ( memberValue != null )
    {
      DateFormat   df= new SimpleDateFormat("h:mm a");
      return df.format(memberValue);
    }else
    {
      return "";
    }
  } 
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.