Java Utililty Methods Date Long Format

List of utility methods to do Date Long Format

Description

The list of methods to do Date Long Format are organized into topic(s).

Method

StringgetLongDateString(Date date)
get Long Date String
return getLongDateString(date, TimeZone.getDefault());
StringgetLongDateString(Date date, boolean includeTime)
Returns long date string representation in localized format (e.g.
if (includeTime) {
    return getDateTimeString(date, DateFormat.LONG, DateFormat.SHORT);
} else {
    return getDateString(date, DateFormat.LONG);
StringgetLongDisplayDate(Date moment, TimeZone tz, Locale inLocale)

Get the displayable date and time string for the given moment in time, in the given timezone, localized in long style.

return getLongDisplayDate(moment, tz, inLocale, true);
StringgetLongDisplayTime(long time)
get Long Display Time
Calendar cd = Calendar.getInstance();
cd.setTimeInMillis(time);
Date date = cd.getTime();
if (date == null) {
    return null;
DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return dateformat.format(date);
...
StringgetLongFormatTime(java.util.Date date)
get Long Format Time
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String strDate = df.format(date);
return strDate;
longgetLongFromDatestamp(String datestamp)
Converts an ISO8601 UTC datastamp String of the form yyyy-MM-ddTHH:mm:ssZ to a long.
return getDateFromDatestamp(datestamp, 0).getTime();
StringgetLongGmtDateString(Date date)
Converts a Date to the GMT timezone and formats it to the format yyyy-MM-dd HH:mm:ssZ.
if (date == null) {
    return null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return simpleDateFormat.format(date);
longgetLongMillis(String date)
get Long Millis
try {
    return dateTimeFormat.parse(date).getTime();
} catch (ParseException e) {
    return 0;
StringgetLongNowTime()
get Long Now Time
return getNowTime(yyyyMMddHHmmssSS);
DoublegetLongOracleDateTime(Date date)
get Long Oracle Date Time
if (date == null) {
    return Double.NaN;
long result = Long.parseLong(sdfYear.format(date)) * 10000000000L
        + Long.parseLong(sdfMonth.format(date)) * 100000000L
        + Long.parseLong(sdfDay.format(date)) * 1000000L + Long.parseLong(sdfHours.format(date)) * 10000L
        + Long.parseLong(sdfMinutes.format(date)) * 100L + Long.parseLong(sdfSeconds.format(date));
return Double.valueOf(result);
...