Package com.google.gwt.i18n.client

Examples of com.google.gwt.i18n.client.DateTimeFormat


    } );
    tablePanel.add( table );
  }

  private String formatDate( final Date date ) {
    DateTimeFormat simpleDateFormat = DateTimeFormat.getFormat( "EEE, MMM dd h:mm a" );
    return simpleDateFormat.format( date );
  }
View Full Code Here


    // prints Dec 18, 2007 12:01:26 PM in the default locale
    GWT.log(DateTimeFormat.getMediumDateTimeFormat().format(today));

    // A custom date format
    DateTimeFormat fmt = DateTimeFormat.getFormat("EEEE, MMMM dd, yyyy");
    // prints Monday, December 17, 2007 in the default locale
    GWT.log(fmt.format(today));
  }
View Full Code Here

    // Set the default value
    datePicker.setValue(new Date(), true);
    advancedDatePicker.setValue(new Date(), true);

    // Create a DateBox
    DateTimeFormat dateFormat = DateTimeFormat.getLongDateFormat();
    DateBox dateBox = new DateBox();
    dateBox.setFormat(new DateBox.DefaultFormat(dateFormat));
    dateBox.getDatePicker().setYearArrowsVisible(true);

    // Combine the widgets into a panel and return them
View Full Code Here

    });
    picker.addShowRangeHandler(new ShowRangeHandler<Date>() {
      public void onShowRange(ShowRangeEvent<Date> event) {
        Date start = event.getStart();
        Date end = event.getEnd();
        DateTimeFormat format = DateTimeFormat.getShortDateFormat();
        range.setText("range: " + format.format(start) + " - "
            + format.format(end));
      }
    });
    return p;
  };
View Full Code Here

      }
    }));

    h2.add(new Button("Show Values", new ClickHandler() {
      public void onClick(ClickEvent event) {
        DateTimeFormat f = DateTimeFormat.getShortDateFormat();
        Date d1 = start.getValue();
        Date d2 = end.getValue();
        value.setText("Start: \"" + (d1 == null ? "null" : f.format(d1))
            + "\" End: \"" + (d2 == null ? "null" : f.format(d2)) + "\"");
      }
    }));

    EventReporter<Date, DateBox> reporter = new EventReporter<Date, DateBox>();
    start.addValueChangeHandler(reporter);
View Full Code Here

    }

    public void onChange(ChangeEvent event) {
        if (!text.getText().equals("")) {
            try {
                DateTimeFormat format = DateTimeFormat
                        .getFormat(getFormatString());
                date = format.parse(text.getText());
                long stamp = date.getTime();
                if (stamp == 0) {
                    // If date parsing fails in firefox the stamp will be 0
                    date = null;
                    addStyleName(PARSE_ERROR_CLASSNAME);
View Full Code Here

    public void addItem(UIDL item) {
      final String styleName = item.getStringAttribute("styleName");
      // final Integer id = new Integer(item.getIntAttribute("id"));

      DateTimeFormat dtf = DateTimeFormat
          .getFormat("d MM yyyy HH:mm:ss Z");

      Date startDate = dtf.parse(item.getStringAttribute("start"));

      // fix times with server-client difference
      int diff = (startDate.getTimezoneOffset() - item
          .getIntAttribute("Z")) * 60000;
      startDate = new Date(startDate.getTime() + diff);
      Date endDate;
      if (item.hasAttribute("end")) {
        endDate = dtf.parse(item.getStringAttribute("end"));
        endDate = new Date(endDate.getTime() + diff);
      } else {
        endDate = (Date) startDate.clone();
      }
      final String title = item.getStringAttribute("title");
View Full Code Here

            trigDesc += ", " + Messages.getString( DayOfWeek.get( getDayOfWeekRecurrences()[i] - 1 )
              .toString().trim() );
          }
        }
      }
      DateTimeFormat timeFormat = DateTimeFormat.getFormat( PredefinedFormat.TIME_MEDIUM );
      trigDesc += " at " + timeFormat.format( getStartTime() );
    } else if ( "simpleJobTrigger".equals( getType() ) ) {
      // if (getRepeatInterval() > 0) {
      trigDesc = getSimpleDescription();

      // if (getStartTime() != null) {
View Full Code Here

      intervalUnits = timeUnitText( intervalSeconds, "second" );
    } else if ( scheduleType == ScheduleType.WEEKLY ) {
      intervalSeconds = 604800;
      intervalUnits = Messages.getString( "weekly" );
    }
    DateTimeFormat timeFormat = DateTimeFormat.getFormat( PredefinedFormat.TIME_MEDIUM );
    if ( scheduleType == ScheduleType.WEEKLY ) {
      int repeatInterval = getRepeatInterval();
      trigDesc =
          Messages.getString( "every" ) + " " + ( repeatInterval / 86400 ) + " " + Messages.getString( "daysLower" );
      trigDesc += " at " + timeFormat.format( getStartTime() );
    } else if ( intervalSeconds != getRepeatInterval() ) {
      trigDesc = Messages.getString( "every" ) + " " + intervalUnits;
      trigDesc += " at " + timeFormat.format( getStartTime() );
    } else {
      trigDesc = Messages.getString( "every" ) + " " + intervalUnits;
      trigDesc += " at " + timeFormat.format( getStartTime() );
    }
    if ( getRepeatCount() > 0 ) {
      trigDesc += "; " + Messages.getString( "run" ) + " " + getRepeatCount() + " " + Messages.getString( "times" );
      // }
    }
View Full Code Here

        try {
          Date date = job.getNextRun();
          if ( date == null ) {
            return "-";
          }
          DateTimeFormat format = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_MEDIUM );
          return format.format( date );
        } catch ( Throwable t ) {
          return "-";
        }
      }
    };
    nextFireColumn.setSortable( true );

    TextColumn<JsJob> lastFireColumn = new TextColumn<JsJob>() {
      public String getValue( JsJob job ) {
        try {
          Date date = job.getLastRun();
          if ( date == null ) {
            return "-";
          }
          DateTimeFormat format = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_MEDIUM );
          return format.format( date );
        } catch ( Throwable t ) {
          return "-";
        }
      }
    };
View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.client.DateTimeFormat

Copyright © 2018 www.massapicom. 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.