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

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

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

DateUtil.hasTime介绍

[英]Returns true if the date has an associated time.
[中]如果日期具有关联的时间,则返回true。

代码示例

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

/**
 * Validates that a time component exists if one is required.
 *
 * @param value The date value.
 */
public void validateDate(Date value) {
  if (requireTime && !DateUtil.hasTime(value)) {
    throw new IllegalArgumentException(requireTimeError);
  }
}

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

/**
 * Convert a date to HL7 format.
 *
 * @param date Date to convert.
 * @return The HL7-formatted date.
 */
public static String toHL7(Date date) {
  Format format = hasTime(date) ? Format.HL7_WITHOUT_TIME : Format.HL7;
  return format.format(date);
}

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

/**
 * Converts a date/time value to a string, using the format dd-mmm-yyyy hh:mm. Because we cannot
 * determine the absence of a time from a time of 24:00, we must assume a time of 24:00 means
 * that no time is present and strip that from the return value.
 *
 * @param date Date value to convert
 * @param showTimezone If true, time zone information is also appended.
 * @param ignoreTime If true, the time component is ignored.
 * @return Formatted string representation of the specified date, or an empty string if date is
 *         null.
 */
public static String formatDate(Date date, boolean showTimezone, boolean ignoreTime) {
  ignoreTime = ignoreTime || !hasTime(date);
  Format format = ignoreTime ? Format.WITHOUT_TIME : showTimezone ? Format.WITH_TZ : Format.WITHOUT_TZ;
  return format.format(date);
}

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

/**
 * Transfers input state between the input box and the drop down dialog. If drop down is true,
 * the date value from the input box is copied to the drop down. If false, the reverse is done.
 *
 * @param open The state of the drop down dialog.
 */
private void update(boolean open) {
  if (open) {
    datebox.setFocus(true);
    datebox.selectAll();
    Date date = getDate();
    updateDatebox(date);
    updateTimebox(DateUtil.hasTime(date) ? date : null);
    clearError();
  } else if (ok) {
    Date date = DateTimeUtil.getTime(datebox, timebox);
    date = timebox.getValue() != null ? DateUtils.setMilliseconds(date, 1) : date;
    setDate(date);
  }
}

相关文章