Android Date to Long Convert parseDateToLong2(String dateString)

Here you can find the source of parseDateToLong2(String dateString)


parse Date To Long, "yyyy-MM-dd"


public static long parseDateToLong2(String dateString) 

Method Source Code

//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static final String FORMAT_DATE_YYYY_MM_DD = "yyyy-MM-dd";

    public static long parseDateToLong2(String dateString) {
        SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATE_YYYY_MM_DD);
        Date date;/*from   www  . j av a2s. co m*/
        try {
            date = sdf.parse(dateString);
            return date.getTime();
        } catch (ParseException e) {
            // TODO Auto-generated catch block
        return 0;


  1. parseDateToLong(String dateString)
  2. parseDateToLongString(String dateString)
  3. geLongFromString(final String date)
  4. getTime(String dateString)
  5. dosToJavaTime(long dosTime)