<p>
Same as {@link #formatDate(Date) formatDate} for the specified locale.
</p>

@param value
Date to be formatted
@param locale
Target locale
@return String representation of the date
966663
public static String formatDate(final Date value, final Locale locale)
    {
        return withinLocale(new Callable<String>()
        {
            public String call() throws Exception
            {
                return formatDate(value);
            }
        }, locale);
    }
827698
public static Date decodeDate(String value) throws ParseException {
		String javaValue = value.substring(0, value.length() - DECODE_DATE_COLONS_INDEX)
				+ value.substring(value.length() - ENCODE_DATE_COLONS_INDEX);
		SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
		dateFormatter.setTimeZone(TimeZone.getTimeZone(UTC_TZ_ID));
		return dateFormatter.parse(javaValue);
	}
476929
public static final Date parseTime(String value)
   {
      Date result = null;
      if (value != null && value.length() != 0)
      {
         try
         {
            result = TIME_FORMAT.get().parse(value);
         }

         catch (ParseException ex)
         {
            // Ignore parse errors
         }
      }
      return result;
   }
809339
@Override
    public Object format(Object value) {
        if (value == null) {
            return nullStringValue;
        }
        if(value.getClass().isArray()) {
            return asList(value);
        } else if (value instanceof Date) {
           Date date = (Date) value;
           if (date.getTime() % ONE_DAY_IN_MILLIS == 0) {
               return new SimpleDateFormat(datePattern).format(date);
           } else {
               return new SimpleDateFormat(dateTimePattern).format(date);
           }
        } else if(value instanceof CompositeData) {
            return toMap((CompositeData)value);
        } else if(value instanceof Element) {
            return parseXmlElement((Element) value);
        }
        
        return value;
    }
640702
private String getDateTimeString(Date value)
   {
      String result = null;
      if (value != null)
      {
         Calendar cal = DateHelper.popCalendar(value);
         StringBuilder sb = new StringBuilder(16);
         sb.append(m_fourDigitFormat.format(cal.get(Calendar.YEAR)));
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.MONTH) + 1));
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.DAY_OF_MONTH)));
         sb.append('T');
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.HOUR_OF_DAY)));
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.MINUTE)));
         sb.append(m_twoDigitFormat.format(cal.get(Calendar.SECOND)));
         sb.append('Z');
         result = sb.toString();
         DateHelper.pushCalendar(cal);
      }
      return result;
   }
989944
protected String formatToString(Object value) {
        if (value == null) return null;
        if (value instanceof CharSequence) {
            return new StringBuilder().append('\'').append(value.toString().replace("'", "\\'")).append('\'').toString();
        } else if (!(value instanceof Number) && !(value instanceof java.util.Date)
            && !value.getClass().getName().startsWith("java.sql.") && !value.getClass().getName().startsWith("java.time.")) {
            return new StringBuilder().append('\'').append(jsonConvert.convertTo(value).replace("'", "\\'")).append('\'').toString();
        }
        return String.valueOf(value);
    }
371254
def format_datetime(self, value, format_):
        
        date_ = make_datetime(value)
        return dates.format_datetime(date_, format_, locale=self.lang)
1196495
public static final String printTime(Date value)
   {
      return (value == null ? null : TIME_FORMAT.get().format(value));
   }
1229309
public String formatDate(String format, Locale loc) {
		MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
		params.putSingle("format", format);
		params.putSingle("locale", loc == null ? null : loc.toString());
		return getEntity(invokeGet("utils/formatdate", params), String.class);
	}
1009460
@Override
    public Object convertUponSet(
                    final Object value
                    )
    {
        Date  date = null;
        if (value != null) {
            try {
                date = _formatter.parse( (String)value );
            } catch (ParseException p_ex) {
                throw new IllegalArgumentException( p_ex.getMessage() );
            }
        }

        return date;
    }
752429
public void setHODate(String value) {
        Calendar cal = Calendar.getInstance();
        cal.setTimeZone(TimeZone.getDefault());
        String[] pcs = value.split("\\,", 2);
        long ms = (Long.parseLong(pcs[0]) - 47116) * 24 * 60 * 60 * 1000;
        cal.setTimeInMillis(ms);
        hasTime = pcs.length == 2;
        
        if (hasTime) {
            int frac = Integer.parseInt(pcs[1]);
            cal.set(Calendar.SECOND, frac % 60);
            frac /= 60;
            cal.set(Calendar.MINUTE, frac % 60);
            frac /= 60;
            cal.set(Calendar.HOUR, frac);
        }
        
        setTime(cal.getTimeInMillis());
    }
1160906
public static Locale getLocale(
    Object      value)
  {
    if (value == null)
    {
        return null;
    }

    if (value instanceof Locale)
    {
        return ((Locale) value);
    }

    return getLocaleInternal(value.toString());
  }
906481
public static java.util.Date toDateTime(Object value) throws ParseException {
        if (value == null) {
            return null;
        }
        if (value instanceof java.util.Date) {
            return (java.util.Date) value;
        }
        if (value instanceof String) {
            if ("".equals((String) value)) {
                return null;
            }
            return IN_DATETIME_FORMAT.parse((String) value);
        }

        return IN_DATETIME_FORMAT.parse(value.toString());
    }
44557
public static String formatPluralCurrency(final Number value, final Locale locale)
    {
        return withinLocale(new Callable<String>()
        {
            public String call() throws Exception
            {
                return formatPluralCurrency(value);
            }
        }, locale);
    }
283707
public static final Date parseFinishDateTime(String value)
   {
      Date result = parseDateTime(value);
      if (result != null)
      {
         result = DateHelper.addDays(result, -1);
      }
      return result;
   }
673669
public CellFormatResult format(final String formatPattern, final String value, final Locale locale) {
        return format(new TextCell(value, formatPattern), locale);
    }
286356
private static Calendar valueAsCalendar(Object value) {
		Date date = (Date) value;
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		return cal;
	}