parse Date in format yyyy-MM-dd HH:mm:ss+SSS - Java java.util

Java examples for java.util:Date Parse

Description

parse Date in format yyyy-MM-dd HH:mm:ss+SSS

Demo Code


//package com.java2s;

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

public class Main {
    public static Date parseFBDate(String str) {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSS");
        try {/*from w  w  w  .j a  va 2 s  .  co m*/
            return df.parse(str.replace("T", " "));
        } catch (ParseException e) {
            return null;
        }
    }
}

Related Tutorials