当前位置: 首页>>代码示例>>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;未经允许,请勿转载。