Java Utililty Methods Date to Long

List of utility methods to do Date to Long

Description

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

Method

longdateToLong(Date date)
Convert the date to a Long value.
return date.getTime();
LongdateToNumber(Date date)
date To Number
if (date == null) {
    return null;
Calendar c = Calendar.getInstance();
c.setTime(date);
String month;
String day;
if ((c.get(Calendar.MONTH) + 1) >= 10) {
...
StringformatDateLong(Date date, Locale locale)
Formats the specified date using the DateFormat#LONG format and the specified locale.
return DateFormat.getDateInstance(DateFormat.LONG, locale).format(date);
LongformatDateToLong(Date date, String format)
format Date To Long
if (date == null) {
    return null;
return Long.valueOf(new SimpleDateFormat(format).format(date));
longformatDateToLong(String strDate, String formatstr)
format Date To Long
if (strDate == null || "".equals(strDate.trim()) || "0".equals(strDate)) {
    return 0;
try {
    SimpleDateFormat sfarmat = new SimpleDateFormat(formatstr);
    Date date = sfarmat.parse(strDate);
    return date.getTime() / 1000;
} catch (Exception e) {
...