Android Date String Parse convertDateStringToLong(String date, String format)

Here you can find the source of convertDateStringToLong(String date, String format)

Description

convert Date String To Long

Declaration

public static long convertDateStringToLong(String date, String format) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static long convertDateStringToLong(String date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);

        long time = -1;
        try {/*from   ww  w  .  j  a  va2  s  .  c  o  m*/
            time = sdf.parse(date).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return time;
    }
}

Related

  1. parseDate(CharSequence input)
  2. parseDate(CharSequence input, Date defaultDate)
  3. parseDate(CharSequence input, String pattern, Date defaultDate)
  4. convertDate(String YearMonthDay)
  5. convertDateStringToDash(String MonthDayYear)
  6. convertDateTime( String YearMonthDayHourMinuteSeconds)
  7. convertToDate(String dateString)
  8. getDateFromString(String format, String dateString)
  9. getDateFromLJString( String dateString)