當前位置: 首頁>>代碼示例>>Java>>正文


Java DateTimeValue類代碼示例

本文整理匯總了Java中com.google.visualization.datasource.datatable.value.DateTimeValue的典型用法代碼示例。如果您正苦於以下問題:Java DateTimeValue類的具體用法?Java DateTimeValue怎麽用?Java DateTimeValue使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DateTimeValue類屬於com.google.visualization.datasource.datatable.value包,在下文中一共展示了DateTimeValue類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDataTable

import com.google.visualization.datasource.datatable.value.DateTimeValue; //導入依賴的package包/類
/**
 * @param mValue
 *          mesured value
 * @return gviz DataTable
 * @throws DataSourceException
 *          data source exception
 */
private static DataTable getDataTable(InterpolatedValue mValue) throws DataSourceException {

  MeasurementType mType = mValue.getMeasurementType();

  DataTable data = new DataTable();

  try {
    data.addColumn(
        new ColumnDescription("Date", ValueType.DATETIME, "Date & Time"));
    data.addColumn(
        new ColumnDescription(mType.getName(), ValueType.NUMBER, mType.toString()));

    TableRow row = new TableRow();

    XMLGregorianCalendar xgcal = DateConvert.convertDate(mValue.getStart());
    row.addCell(new DateTimeValue(convertTimestamp(xgcal)));
    row.addCell(mValue.getValue());

    data.addRow(row);
  }
  catch (TypeMismatchException | DatatypeConfigurationException e) {
    throw new DataSourceException(ReasonType.INTERNAL_ERROR, "Problem adding data to table"); // NOPMD
  }
  return data;
}
 
開發者ID:wattdepot,項目名稱:wattdepot,代碼行數:33,代碼來源:GvizHelper.java

示例2: getDateFromValue

import com.google.visualization.datasource.datatable.value.DateTimeValue; //導入依賴的package包/類
/**
 * Converts the given value to date. The value must be of type date or datetime.
 *
 * @param value The given value.
 *
 * @return Date object with the same value as the given value.
 */
private Date getDateFromValue(Value value) {
  Calendar calendar;
  if (value.getType() == ValueType.DATE) {
    calendar = ((DateValue) value).getObjectToFormat();
  } else { // datetime
    calendar = ((DateTimeValue) value).getObjectToFormat();
  }
  return calendar.getTime();
}
 
開發者ID:dzxdzx1987,項目名稱:GoogleCharts,代碼行數:17,代碼來源:DateDiff.java

示例3: parseDateTime

import com.google.visualization.datasource.datatable.value.DateTimeValue; //導入依賴的package包/類
/**
 * Parses a string to a date time value.
 *
 * @param val The string to parse.
 *
 * @return A date time value based on the given string.
 *
 * @throws ParseException If val cannot be parsed into a date.
 */
private DateTimeValue parseDateTime(String val) throws ParseException {
  Date date = ((SimpleDateFormat) uFormat).parse(val);
  GregorianCalendar gc = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
  gc.setTime(date);
  return new DateTimeValue(gc);
}
 
開發者ID:dzxdzx1987,項目名稱:GoogleCharts,代碼行數:16,代碼來源:ValueFormatter.java

示例4: evaluate

import com.google.visualization.datasource.datatable.value.DateTimeValue; //導入依賴的package包/類
/**
 * Evaluates this scalar function. Returns a DateTime with the current time.
 *
 * @param values Ignored.
 *
 * @return A DateTime value with the current time.
 */
public Value evaluate(List<Value> values) {
  return new DateTimeValue(new GregorianCalendar(
      TimeZone.getTimeZone("GMT")));
}
 
開發者ID:dzxdzx1987,項目名稱:GoogleCharts,代碼行數:12,代碼來源:CurrentDateTime.java


注:本文中的com.google.visualization.datasource.datatable.value.DateTimeValue類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。