Package com.google.gwt.i18n.client

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


//      } else if (attr.getType().equals(PrimitiveType.DATE)) {

        if (attr.getType().equals(PrimitiveType.DATE)) {
          if (value instanceof Date) {
            // In case of a date, parse correctly for CQL: 2006-11-30T01:30:00Z
            DateTimeFormat format = DateTimeFormat.getFormat(CQL_TIME_FORMAT);

            if ("=".equals(operatorString)) {
              // Date equals not supported by CQL, so we use the DURING operator instead:
              operatorString = "DURING";
              Date date1 = (Date) value;
              Date date2 = new Date(date1.getTime() + 86400000); // total milliseconds in a day
              valueString = format.format(date1) + "/" + format.format(date2);
            } else {
              // Simply format the date:
              valueString = format.format((Date) value);
            }
          }
        }
      }
View Full Code Here


          valueString = "'" + valueString + "'";

        } else if (attr.getType().equals(PrimitiveType.DATE)) {
          if (value instanceof Date) {
            // In case of a date, parse correctly for CQL: 2006-11-30T01:30:00Z
            DateTimeFormat format = DateTimeFormat.getFormat(CQL_TIME_FORMAT);

            if ("=".equals(operatorString)) {
              // Date equals not supported by CQL, so we use the DURING operator instead:
              operatorString = "DURING";
              Date date1 = (Date) value;
              Date date2 = new Date(date1.getTime() + 86400000); // total milliseconds in a day
              valueString = format.format(date1) + "/" + format.format(date2);
            } else {
              // Simply format the date:
              valueString = format.format((Date) value);
            }
          }
        }
      }
View Full Code Here

      data.addColumn(DataTable.ColumnType.DATETIME, "start");
      data.addColumn(DataTable.ColumnType.DATETIME, "end");
      data.addColumn(DataTable.ColumnType.STRING, "content");
      data.addColumn(DataTable.ColumnType.STRING, "group");

        DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");

        // fill the table with some random data
        int row = 0;
        for (int truck = 11; truck < 15; truck++) {
          Date date = dtf.parse("2010-12-14 08:00:00");
          for (int i = 0; i < 8; i++) {
            int diffHour = 1 * 4 * (Math.random() < 0.2 ? 1 : 0);
            date.setTime(date.getTime() + diffHour * 60 * 60 * 1000);
           
            Date start = new Date(date.getTime());
View Full Code Here

  /**
   * Get the range from the timeline and put it in the textboxes on screen
   */
  private void getRange() {
    Timeline.DateRange range = timeline.getVisibleChartRange();
    DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");

    // set the new startdate and enddate
    txtStartDate.setText(dtf.format(range.getStart()));
    txtEndDate.setText(dtf.format(range.getEnd()));
  }
View Full Code Here

  /**
   * Get the entered dates from the textboxes on screen, and apply them to
   * the timeline
   */ 
  private void setRange() {
    DateTimeFormat datetime = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");
    DateTimeFormat date = DateTimeFormat.getFormat("yyyy-MM-dd");

    Date startDate;
    Date endDate;

    // Try to parse the startdate
    try {
      startDate = datetime.parse(txtStartDate.getText());
    } catch (IllegalArgumentException err) {
      try {
        startDate = date.parse(txtStartDate.getText());
      } catch (IllegalArgumentException err2) {
        Window.alert("I don't understand the startdate that you entered :(");
        return;
      }
    }

    // Try to parse the enddate
    try {
      endDate = datetime.parse(txtEndDate.getText());
    } catch (IllegalArgumentException err) {
      try {
        endDate = date.parse(txtEndDate.getText());
      } catch (IllegalArgumentException err2) {
        Window.alert("I cannot make sense of the enddate that you entered :(");
        return;
      }
    }
View Full Code Here

        // Log.debug("ZoomableTimeline.updateLabels curback
        // "+-getCurbackX()+" "+" "+d2+"
        // ii "+ii+" "+backGroundList.get(index));

        DateTimeFormat format = currentZoom.getDfFormat();
        for (ProteanLabel label : labelList) {
            label.setCenter(d2, currentZoom);
        }
    }
View Full Code Here

     *            the date to format
     *
     * @return given Date as String, for communicating to server-side
     */
    public static String formatClientSideDate(Date date) {
        DateTimeFormat dateformat_date = DateTimeFormat
                .getFormat(DateConstants.CLIENT_DATE_FORMAT);
        return dateformat_date.format(date);
    }
View Full Code Here

     * @param date
     *            the date to format
     * @return given Date as String, for communicating to server-side
     */
    public static String formatClientSideTime(Date date) {
        DateTimeFormat dateformat_date = DateTimeFormat
                .getFormat(DateConstants.CLIENT_TIME_FORMAT);
        return dateformat_date.format(date);
    }
View Full Code Here

     * @return
     * @throws ParseException
     */
    public Date getActionStartDate(String actionKey) throws ParseException {
        String dateStr = actionMap.get(actionKey + "_s");
        DateTimeFormat formatter = DateTimeFormat
                .getFormat(DateConstants.ACTION_DATE_FORMAT_PATTERN);
        return formatter.parse(dateStr);
    }
View Full Code Here

     * @return
     * @throws ParseException
     */
    public Date getActionEndDate(String actionKey) throws ParseException {
        String dateStr = actionMap.get(actionKey + "_e");
        DateTimeFormat formatter = DateTimeFormat
                .getFormat(DateConstants.ACTION_DATE_FORMAT_PATTERN);
        return formatter.parse(dateStr);
    }
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.