本文整理了Java中org.carewebframework.common.DateUtil.formatDate()
方法的一些代码示例,展示了DateUtil.formatDate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateUtil.formatDate()
方法的具体详情如下:
包路径:org.carewebframework.common.DateUtil
类名称:DateUtil
方法名:formatDate
[英]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.
[中]使用dd-mmm-yyy-hh:mm格式将日期/时间值转换为字符串。因为我们无法从24:00的时间中确定是否缺少时间,所以我们必须假设24:00的时间意味着不存在时间,并从返回值中删除该时间。
代码示例来源:origin: org.carewebframework/org.carewebframework.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.
* @return Formatted string representation of the specified date, or an empty string if date is
* null.
*/
public static String formatDate(Date date) {
return formatDate(date, false, false);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.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.
* @return Formatted string representation of the specified date, or an empty string if date is
* null.
*/
public static String formatDate(Date date, boolean showTimezone) {
return formatDate(date, showTimezone, false);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.common
/**
* Same as formatDate(Date, boolean) except replaces the time separator with the specified
* string.
*
* @param date Date value to convert
* @param timeSeparator String to use in place of default time separator
* @return Formatted string representation of the specified date using the specified time
* separator.
*/
public static String formatDate(Date date, String timeSeparator) {
return formatDate(date).replaceFirst(" ", timeSeparator);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.common
/**
* Create a date range from individual components.
*
* @param label Displayable text. If null, a default label is created.
* @param startDate The start date.
* @param endDate The end date.
*/
public DateRange(String label, Date startDate, Date endDate) {
this.startDate = startDate;
this.endDate = endDate;
this.rawStartDate = DateUtil.formatDate(startDate);
this.rawEndDate = DateUtil.formatDate(endDate);
checkDates();
this.label = label != null ? label : (rawStartDate + " to " + rawEndDate);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.cal.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.carewebframework/org.carewebframework.vista.api.core
public static String normalizeDate(String value, boolean includeTime) {
Date date = parseDate(value);
return date == null ? "" : DateUtil.formatDate(date, false, !includeTime);
}
代码示例来源:origin: org.hspconsortium.carewebframework/cwf-ui-patientheader
private String formatDateAndAge(Date date) {
return date == null ? null : DateUtil.formatDate(date) + " (" + DateUtil.formatAge(date) + ")";
}
代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.reporting
/**
* Add a row containing the specified header (left column) and value (right column).
*
* @param header Text for header column
* @param value Date object
*/
protected void addRow(String header, Date value) {
try {
addRow(header, DateUtil.formatDate(value));
} catch (Exception e) {
log.error(e.getMessage(), e);
addRow(header, e.getMessage());
}
}
代码示例来源:origin: org.carewebframework/org.carewebframework.common
private void doTestFormatting(String time, String expected) throws Exception {
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy" + (time.length() == 0 ? "" : " HH:mm"));
Date date = formatter.parse(DATE + time);
assertEquals(DateUtil.formatDate(date), DATE + expected);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.common
private void testDateFormat(String tz, String time) throws Exception {
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm zzz");
Date date = formatter.parse(DATE + " 13:04 EST"); // Reference date/time is 21-Nov-1978 13:04 EST
TimeZone.setDefault(TimeZone.getTimeZone(tz));
String DATE_TIME_NOTZ = DATE + " " + time;
String DATE_TIME_TZ = DATE_TIME_NOTZ + " " + tz;
assertEquals(DATE_TIME_TZ, DateUtil.formatDate(date, true));
assertEquals(DATE_TIME_NOTZ, DateUtil.formatDate(date));
assertEquals(DATE, DateUtil.formatDate(date, true, true));
assertEquals(DATE_TIME_NOTZ, DateUtil.formatDate(date, false));
assertEquals(DATE_TIME_NOTZ, DateUtil.formatDate(date, false, false));
formatter = new SimpleDateFormat("dd-MMM-yyyy");
date = formatter.parse(DATE);
assertEquals(DATE, DateUtil.formatDate(date, true));
assertEquals(DATE, DateUtil.formatDate(date));
assertEquals(DATE, DateUtil.formatDate(date, true, true));
assertEquals(DATE, DateUtil.formatDate(date, false));
assertEquals(DATE, DateUtil.formatDate(date, false, false));
}
代码示例来源:origin: org.carewebframework/org.carewebframework.common
private void testDate(Date date, boolean showTimezone, boolean ignoreTime) {
String text = DateUtil.formatDate(date, showTimezone, ignoreTime);
print(text);
Date date2 = DateUtil.parseDate(text);
String text2 = DateUtil.formatDate(date2, showTimezone, ignoreTime);
assertEquals(text, text2);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.vista.api.notification
/**
* Returns the display text for this notification.
*
* @return Display text.
*/
public String getDisplayText() {
StringBuilder sb = new StringBuilder();
appendText(sb, getPatientName(), "patient");
appendText(sb, getSubject(), "subject");
appendText(sb, getSenderName(), "sender");
appendText(sb, DateUtil.formatDate(getDeliveryDate()), "delivered");
appendText(sb, getPriority().toString(), "priority");
appendText(sb, "dummy", isActionable() ? "actionable" : "infoonly");
appendText(sb, "dummy", canDelete() ? "delete.yes" : "delete.no");
if (message != null && !message.isEmpty()) {
sb.append("\n");
for (String text : message) {
sb.append(text).append("\n");
}
}
return sb.toString();
}
代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.anticoag
private void updateEndDate() {
record.setDuration(cboDuration.getText());
record.setStartDate(datStart.getValue());
String text = record.getEndDate() == null ? "Indefinitely" : DateUtil.formatDate(record.getEndDate());
txtEnd.setText(text);
}
代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.cwad
@Override
protected void renderItem(Listitem item, String data) {
createCell(item, StrUtil.piece(data, U, 2));
createCell(item, StrUtil.piece(data, U, 3));
FMDate date = FMDate.fromString(StrUtil.piece(data, U, 5));
createCell(item, DateUtil.formatDate(date));
}
代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.encounter
PeriodDt period = encounter.getPeriod();
Date date = period.isEmpty() ? null : period.getStart();
lblDate.setValue(DateUtil.formatDate(date));
Participant participant = EncounterParticipantContext.getActiveParticipant();
String name = participant == null ? null : FhirUtil.formatName(EncounterUtil.getName(participant));
代码示例来源:origin: org.carewebframework/org.carewebframework.cal.ui.reporting
text += " Died: " + DateUtil.formatDate(deceased);
代码示例来源:origin: org.carewebframework/org.carewebframework.vista.ui.vitals
col.setLabel(DateUtil.formatDate(dtmDate.getDate()));
int rows = grdVitals.getRows().getChildren().size();
int idx = getColumnIndex(col);
代码示例来源:origin: org.carewebframework/org.carewebframework.rpms.ui.problem
private void renderNote(ProblemNote pn) {
Listitem item = new Listitem();
lstNotes.appendChild(item);
Listcell cell = addCell(item, "");
cell.setSclass("bgo-problem-icon-cell");
Toolbarbutton btn = new Toolbarbutton("", DELETE_ICON);
btn.setTooltiptext("Delete this note.");
btn.addForward(Events.ON_CLICK, lstNotes, "onDeleteNote");
cell.appendChild(btn);
addCell(item, pn.getNumber()); // Note #
addCell(item, pn.getNarrative()).setHflex("1"); // Narrative
addCell(item, DateUtil.formatDate(pn.getDateAdded())); // Date added
addCell(item, pn.getAuthor()); // Author
item.setValue(pn);
}
内容来源于网络,如有侵权,请联系作者删除!