Java Parse Date parseDateAndGetLong(String date)

Here you can find the source of parseDateAndGetLong(String date)

Description

parse Date And Get Long

License

Apache License

Declaration

public static String parseDateAndGetLong(String date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Main {
    public static final String DEFAULT_DATE_FORMAT = "dd-MM-yyyy HH:mm:ss";

    public static String parseDateAndGetLong(String date) {
        DateFormat format = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
        try {/*from  www.ja v a 2s. co  m*/
            return String.valueOf(format.parse(date).getTime());
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return "";
    }
}

Related

  1. parseDate(String value, String formater)
  2. parseDate(String value, String pattern)
  3. parseDate2String(Date date)
  4. parseDate4UrlCreateTime(String dateStr)
  5. parseDateAllowNull(String date)
  6. parseDateAsString(Date value)
  7. parseDateForFilter(String date)
  8. parseDateFormat(String s, String pattern, TimeZone tz)
  9. parseDateFrom(String dateStr)