Android Date to Long Convert getTime(String dateString)

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

Description

get Time

License

Apache License

Declaration

public static long getTime(String dateString) 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.os.SystemClock;

public class Main {
    public static long getTime(String dateString) {
        SimpleDateFormat formatter = new SimpleDateFormat(
                "yyyy-MM-dd HH:mm:ss");
        try {/* w ww.  j  a  v a2s  . co m*/
            Date date = formatter.parse(dateString);
            return date.getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return SystemClock.elapsedRealtime();
    }
}

Related

  1. parseDateToLong(String dateString)
  2. parseDateToLong2(String dateString)
  3. parseDateToLongString(String dateString)
  4. geLongFromString(final String date)
  5. dosToJavaTime(long dosTime)
  6. dosToJavaTme(int dosTime)
  7. getDateLong(Date date)