Java Timestamp Parse parseTimeStamp(String timeStamp)

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

Description

parse Time Stamp

License

Apache License

Declaration

public static Calendar parseTimeStamp(String timeStamp) 

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.Calendar;
import java.util.GregorianCalendar;

public class Main {
    public static final DateFormat FORMAT_DATE_TIME = new SimpleDateFormat("dd/MM/yyyy HH:mm");
    public static final DateFormat FORMAT_TIMESTAMP = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss.SSS");

    public static Calendar parseTimeStamp(String timeStamp) {
        return parseDateTime(timeStamp, FORMAT_TIMESTAMP);
    }// ww  w  .  j ava 2 s  .c om

    public static Calendar parseDateTime(String dateTime) {
        return parseDateTime(dateTime, FORMAT_DATE_TIME);
    }

    public static Calendar parseDateTime(String dateTime, DateFormat format) {
        Calendar resultado = GregorianCalendar.getInstance();
        try {
            resultado.setTime(format.parse(dateTime));
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
        return resultado;
    }
}

Related

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