Java Time Parse getTimeFromString(String time)

Here you can find the source of getTimeFromString(String time)

Description

get Time From String

License

Open Source License

Declaration

public static long getTimeFromString(String time) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    private static String dateFormatString = "MM/dd/yyyy HH:mm:ss";

    public static long getTimeFromString(String time) {
        SimpleDateFormat format = new SimpleDateFormat(dateFormatString);
        try {/*from   w w  w  .  jav a  2  s.c  o  m*/
            Date date = format.parse(time);
            return date.getTime();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. getTimeFileName(String suffix)
  2. getTimeFromGermanLocale(String timeString)
  3. getTimeFromJsToJava(String date)
  4. getTimeList(String start, String end, int pitch)
  5. getTimeStr(String date1, String date2)
  6. getTimeWithStr(String source, String pattern)
  7. getTimeX(String dateStr)