ISODateTimeFormat 转换2019-08-15T00:36:49.366456463Z 日期格式

import java.text.*;
import java.text.SimpleDateFormat;
import java.util.*;

import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;

/**
 * Created by sixinshuier on 2019/08/15
 */
public class Test {

    public static void main(String args[]) throws ParseException {
        DateTime date = ISODateTimeFormat.dateTime().parseDateTime("2019-08-15T00:36:49.366456463Z");
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
        Date time = df.parse(date.toString());
        SimpleDateFormat df1 = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
        Date date1 = df1.parse(time.toString());
        DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String str = df2.format(date1);
        System.out.println(str);
    }
}

 

posted @ 2019-08-16 17:04  sixinshuier  阅读(2537)  评论(0编辑  收藏  举报