18 package org.turro.elephant.util;
20 import java.text.DateFormat;
21 import java.text.DateFormatSymbols;
22 import java.text.SimpleDateFormat;
23 import java.util.Date;
24 import org.amic.util.date.CheckDate;
25 import org.turro.elephant.context.Application;
33 public static final String
format(Date d,
boolean dateOnly) {
34 if(d ==
null)
return null;
36 return org.amic.util.date.DateFormats.format(d,
39 return org.amic.util.date.DateFormats.format(d,
44 public static String
formatNull(Date d,
boolean dateOnly) {
52 final DateFormat df = DateFormat.getDateInstance(
54 if (df instanceof SimpleDateFormat) {
55 final String fmt = ((SimpleDateFormat)df).toPattern();
56 if (fmt !=
null && !
"M/d/yy h:mm a".equals(fmt))
63 final DateFormat df = DateFormat.getDateTimeInstance(
65 if (df instanceof SimpleDateFormat) {
66 final String fmt = ((SimpleDateFormat)df).toPattern();
67 if (fmt !=
null && !
"M/d/yy h:mm a".equals(fmt))
70 return "yyyy/MM/dd hh:mm a";
75 return dfs.getMonths()[
new CheckDate(date).getMonth() - 1];
82 final DateFormat df = DateFormat.getTimeInstance(
static Locale getUsedLocale()