Java Timestamp Parse parseTimeStamp(String timeStamp)

Here you can find the source of parseTimeStamp(String timeStamp)

Description

parse Time Stamp

License

Open Source License

Declaration

public static long parseTimeStamp(String timeStamp) throws ParseException 

Method Source Code

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

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

import java.util.Date;

public class Main {

    public static long parseTimeStamp(String timeStamp) throws ParseException {
        SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
        Date date;//from  ww w  .  j a  v a  2  s  . c o m
        try {
            date = format.parse(timeStamp);
        } catch (ParseException e) {
            SimpleDateFormat optFormat = new SimpleDateFormat("yy-MM-dd HH:mm");
            date = optFormat.parse(timeStamp);
        }
        return date.getTime();
    }
}

Related

  1. parseTimestamp(String src, String pattern)
  2. parseTimestamp(String strDate)
  3. parseTimestamp(String time)
  4. parseTimestamp(String timestamp)
  5. parseTimeStamp(String timeStamp)
  6. parseTimestamp(String timestamp)
  7. parseTimestamp(String timestamp)
  8. parseTimestamp(String timestamp, String dateFormat, Locale locale)
  9. parseTimeStamp(String timeStampString)