Java Time Parse strtotime(String strtime)

Here you can find the source of strtotime(String strtime)

Description

strtotime

License

LGPL

Declaration

public static long strtotime(String strtime) 

Method Source Code


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

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

public class Main {
    public static String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static long strtotime(String strtime) {
        try {/*  ww w  .j av a2s  .  co  m*/
            SimpleDateFormat format = new SimpleDateFormat(TIME_FORMAT);
            return format.parse(strtime).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return 0;
    }
}

Related

  1. isDateTime(String dateTime, String pattern)
  2. isDatetimeParsable(String value)
  3. isFromartDate(String time)
  4. isTime(final String date)
  5. isTime(String timeStr)