/** * Return a string with a reasonable and complete representation of the * given <code>Date</code>, shown in UTC. * * @param date <code>Date</code> to be represented * @return a string containing the representation of the date */ public static String formatDate(Date date) { return CalendarDateFormatter.toDateTimeString(date); }
public static void main(String arg[]) { CalendarDate cd = CalendarDate.present(); /* {"S", "M", "L", "F", "-"} System.out.printf("%s%n", DateTimeFormat.forStyle("SS").print(cd.getDateTime())); System.out.printf("%s%n", DateTimeFormat.forStyle("MM").print(cd.getDateTime())); System.out.printf("%s%n", DateTimeFormat.forStyle("LL").print(cd.getDateTime())); System.out.printf("%s%n", DateTimeFormat.forStyle("FF").print(cd.getDateTime())); */ System.out.printf("%s%n", cd); System.out.printf("%s%n", toDateTimeStringISO(cd)); System.out.printf("%s%n", toDateTimeString(cd)); System.out.printf("%s%n", toDateString(cd)); Date d = new Date(); System.out.printf("%s%n", toDateTimeString(d)); DateFormatter df = new DateFormatter(); System.out.printf("%s%n", df.toDateTimeString(d)); System.out.printf("%s%n", df.toDateOnlyString(d)); }
public static void main(String arg[]) { CalendarDate cd = CalendarDate.present(); /* {"S", "M", "L", "F", "-"} System.out.printf("%s%n", DateTimeFormat.forStyle("SS").print(cd.getDateTime())); System.out.printf("%s%n", DateTimeFormat.forStyle("MM").print(cd.getDateTime())); System.out.printf("%s%n", DateTimeFormat.forStyle("LL").print(cd.getDateTime())); System.out.printf("%s%n", DateTimeFormat.forStyle("FF").print(cd.getDateTime())); */ System.out.printf("%s%n", cd); System.out.printf("toDateTimeStringISO=%s%n", toDateTimeStringISO(cd)); System.out.printf(" toDateTimeString=%s%n", toDateTimeString(cd)); System.out.printf(" toDateString=%s%n", toDateString(cd)); System.out.printf(" toTimeUnits=%s%n", toTimeUnits(cd)); System.out.printf("===============================%n"); Date d = cd.toDate(); System.out.printf("cd.toDate()=%s%n", toDateTimeString(d)); SimpleDateFormat udunitDF = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, Locale.US); udunitDF.setTimeZone(TimeZone.getTimeZone("UTC")); udunitDF.applyPattern("yyyy-MM-dd HH:mm:ss.SSS 'UTC'"); System.out.printf(" udunitDF=%s%n", udunitDF.format(d)); System.out.printf("===============================%n"); DateFormatter df = new DateFormatter(); System.out.printf(" toTimeUnits(date)=%s%n", toTimeUnits(cd)); System.out.printf("toDateTimeString(date)=%s%n", df.toDateTimeString(d)); System.out.printf("toDateOnlyString(date)=%s%n", df.toDateOnlyString(d)); }
/** * Return a string with a reasonable and complete representation of the * given <code>Date</code>, shown in UTC. * * @param date <code>Date</code> to be represented * @return a string containing the representation of the date */ public static String formatDate(Date date) { return CalendarDateFormatter.toDateTimeString(date); }
public static void main(String arg[]) { CalendarDate cd = CalendarDate.present(); /* {"S", "M", "L", "F", "-"} System.out.printf("%s%n", DateTimeFormat.forStyle("SS").print(cd.getDateTime())); System.out.printf("%s%n", DateTimeFormat.forStyle("MM").print(cd.getDateTime())); System.out.printf("%s%n", DateTimeFormat.forStyle("LL").print(cd.getDateTime())); System.out.printf("%s%n", DateTimeFormat.forStyle("FF").print(cd.getDateTime())); */ System.out.printf("%s%n", cd); System.out.printf("toDateTimeStringISO=%s%n", toDateTimeStringISO(cd)); System.out.printf(" toDateTimeString=%s%n", toDateTimeString(cd)); System.out.printf(" toDateString=%s%n", toDateString(cd)); System.out.printf(" toTimeUnits=%s%n", toTimeUnits(cd)); System.out.printf("===============================%n"); Date d = cd.toDate(); System.out.printf("cd.toDate()=%s%n", toDateTimeString(d)); SimpleDateFormat udunitDF = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, Locale.US); udunitDF.setTimeZone(TimeZone.getTimeZone("UTC")); udunitDF.applyPattern("yyyy-MM-dd HH:mm:ss.SSS 'UTC'"); System.out.printf(" udunitDF=%s%n", udunitDF.format(d)); System.out.printf("===============================%n"); DateFormatter df = new DateFormatter(); System.out.printf(" toTimeUnits(date)=%s%n", toTimeUnits(cd)); System.out.printf("toDateTimeString(date)=%s%n", df.toDateTimeString(d)); System.out.printf("toDateOnlyString(date)=%s%n", df.toDateOnlyString(d)); }
@Override public String toString() { Formatter f = new Formatter(); if (isCalendarField) f.format("%s", byCalendarString); f.format("%s since %s", unitString, CalendarDateFormatter.toDateTimeString(baseDate)); return f.toString(); }
@Override public String toString() { Formatter f = new Formatter(); if (isCalendarField) f.format("%s", byCalendarString); f.format("%s since %s", unitString, CalendarDateFormatter.toDateTimeString(baseDate)); return f.toString(); }
static public String toDateTimeString(Date date) { return toDateTimeString(CalendarDate.of(date)); }
static public String toDateTimeString(Date date) { return toDateTimeString(CalendarDate.of(date)); }
static public String toDateTimeString(Date date) { return toDateTimeString(CalendarDate.of(date)); }
@Override public List<NamedObject> getNames() { List<CalendarDate> cdates = getCalendarDates(); List<NamedObject> names = new ArrayList<NamedObject>(cdates.size()); for (CalendarDate cd : cdates) names.add(new NamedAnything(CalendarDateFormatter.toDateTimeString(cd), "calendar date")); return names; }
@Override public List<NamedObject> getNames() { List<CalendarDate> cdates = getCalendarDates(); List<NamedObject> names = new ArrayList<>(cdates.size()); for (CalendarDate cd : cdates) names.add(new NamedAnything(CalendarDateFormatter.toDateTimeString(cd), "calendar date")); return names; }
sbuff.append(" title= ").append(getTitle()).append("\n"); sbuff.append(" desc= ").append(getDescription()).append("\n"); sbuff.append(" start= ").append(CalendarDateFormatter.toDateTimeString(getStartDate())).append("\n"); sbuff.append(" end = ").append(CalendarDateFormatter.toDateTimeString(getEndDate())).append("\n"); sbuff.append(" bb = ").append(getBoundingBox()).append("\n"); if (getBoundingBox() != null)
rootElem.setAttribute("runTime", runTimeString); if (lastModified != null) { rootElem.setAttribute("lastModified", CalendarDateFormatter.toDateTimeString(lastModified));
rootElem.setAttribute("runTime", runTimeString); if (lastModified != null) { rootElem.setAttribute("lastModified", CalendarDateFormatter.toDateTimeString(lastModified));
rootElem.setAttribute("runTime", runTimeString); if (lastModified != null) { rootElem.setAttribute("lastModified", CalendarDateFormatter.toDateTimeString(lastModified));