org.fujion.common.DateUtil.stripTime()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.fujion.common.DateUtil.stripTime()方法的一些代码示例,展示了DateUtil.stripTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateUtil.stripTime()方法的具体详情如下:
包路径:org.fujion.common.DateUtil
类名称:DateUtil
方法名:stripTime

DateUtil.stripTime介绍

[英]Strips the time component from a date.
[中]从日期中剥离时间组件。

代码示例

代码示例来源:origin: org.fujion/fujion-common

/**
 * Returns true if the date has an associated time.
 *
 * @param date Date value to check.
 * @return True if the date has a time component.
 */
public static boolean hasTime(Date date) {
  if (date == null) {
    return false;
  }
  
  long time1 = date.getTime();
  long time2 = stripTime(date).getTime();
  return time1 != time2; // Do not use "Date.equals" since date may be of type Timestamp.
}

代码示例来源:origin: org.hspconsortium.carewebframework/cwf-ui-reporting

/**
 * Returns the current date in standard format.
 *
 * @return Timestamp for current date.
 */
public String getTimestamp() {
  return DateUtil.formatDate(DateUtil.stripTime(new Date()));
}

代码示例来源:origin: org.fujion/fujion-common

/**
 * Returns a date with the current day (no time).
 *
 * @return Current date.
 */
public static Date today() {
  return stripTime(now());
}

代码示例来源:origin: org.carewebframework/org.carewebframework.ui.core

/**
 * Update the datebox with the new value.
 *
 * @param date New date value.
 */
private void updateDatebox(Date date) {
  datebox.setValue(DateUtil.stripTime(date));
}

代码示例来源:origin: org.carewebframework/org.carewebframework.ui.core

/**
 * Sets the UI to reflect the specified time.
 *
 * @param datebox The date box.
 * @param timebox The time box.
 * @param value Time value to set.
 */
public static void setTime(Datebox datebox, Timebox timebox, Date value) {
  value = value == null ? new Date() : value;
  datebox.setValue(DateUtil.stripTime(value));
  timebox.setValue(value);
}

代码示例来源:origin: org.carewebframework/org.carewebframework.ui.core

/**
 * Returns a date/time from the UI. This is combined from two UI input elements, one for date
 * and one for time.
 *
 * @param datebox The date box.
 * @param timebox The time box.
 * @return The combined date/time.
 */
public static Date getTime(Datebox datebox, Timebox timebox) {
  if (timebox.getValue() == null || datebox.getValue() == null) {
    return DateUtil.stripTime(datebox.getValue());
  }
  Calendar date = Calendar.getInstance();
  Calendar time = Calendar.getInstance();
  date.setTime(datebox.getValue());
  time.setTime(timebox.getValue());
  time.set(date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH));
  return time.getTime();
}

代码示例来源:origin: org.carewebframework/org.carewebframework.api.core

/**
 * Filter result based on selected date range.
 */
@Override
public boolean include(T result) {
  return getDateRange().inRange(DateUtil.stripTime(dateTypeExtractor.getDateByType(result, dateType)), true, true);
}

代码示例来源:origin: org.fujion/fujion-common

private Date today() {
  return DateUtil.stripTime(now());
}

相关文章