Java String to Time getTime(String s)

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

Description

get Time

License

Apache License

Declaration

public static long getTime(String s) 

Method Source Code


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

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

import java.util.Date;

public class Main {

    public static long getTime(String s) {
        return parseMysql(s).getTime();
    }/*from w ww  . j a  v  a2s.  com*/

    public static Date parseMysql(String s) {
        try {
            DateFormat fmtTemp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return fmtTemp.parse(s);
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. getTime(String dateTimeString)
  2. getTime(String file)
  3. getTime(String parrten)
  4. getTime(String pattern)
  5. getTime(String pattern)
  6. getTime(String sDateTime, String eDateTime)
  7. getTime(String time)
  8. getTime(String time)
  9. getTimeDate(String time)