Java Date Parse getDateFromDCItemTimestamp(String dateTimeStamp)

Here you can find the source of getDateFromDCItemTimestamp(String dateTimeStamp)

Description

get Date From DC Item Timestamp

License

Open Source License

Declaration

public static Date getDateFromDCItemTimestamp(String dateTimeStamp) 

Method Source Code


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

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

import java.util.Date;

import java.util.TimeZone;

public class Main {
    public static Date getDateFromDCItemTimestamp(String dateTimeStamp) {

        Date dateTime = null;//from  w w  w  . ja  v  a  2 s .c o  m
        if (dateTimeStamp != null && dateTimeStamp.length() > 0) {
            SimpleDateFormat ISO8601Local = new SimpleDateFormat("yyyyMMddHHmmss");
            TimeZone timeZone = TimeZone.getDefault();
            ISO8601Local.setTimeZone(timeZone);
            try {
                dateTime = (Date) ISO8601Local.parse(dateTimeStamp.trim());
            } catch (ParseException e) {
                System.err.println(dateTimeStamp);
                System.err.println("Error parsing date string should be yyyyMMddHHmmss format: " + e.getMessage());
            }
        }
        return dateTime;
    }
}

Related

  1. DateTimeParse(String DateTimeString, String LMS)
  2. getDateFromCurrentAnd24HRTime(Date current, String hr24Time)
  3. getDateFromDateAge(Date currentDate, String age)
  4. getDateFromDatestamp(String datestamp)
  5. getDateFromDateTimeUTCFormat(final String dateString)
  6. getDateFromFileName(String fileName)
  7. getDateFromFormat(Date date, String type)
  8. getDateFromFormattedDate(String dateStr, String format)
  9. getDateFromFormattedTimeStamp( String formattedTimeStamp)