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

本文介绍了一个使用Java和Joda-Time进行日期时间格式转换的示例,包括从ISO格式字符串解析到Java Date对象的过程,以及不同日期格式之间的转换方法。
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);
    }
}

 

转载于:https://www.cnblogs.com/shix0909/p/11365052.html

ValueError: failed to prevent overwriting existing key calendar in attrs on variable 'time'. This is probably an encoding field used by xarray to describe how a variable is serialized. To proceed, remove this key from the variable's attributes manually. Raised while encoding variable 'time' with value <xarray.IndexVariable 'time' (time: 30)> Size: 240B array(['1960-08-01T00:00:00.000000000', '1962-07-01T00:00:00.000000000', '1964-06-01T00:00:00.000000000', '1966-04-01T00:00:00.000000000', '1968-03-01T00:00:00.000000000', '1970-01-01T00:00:00.000000000', '1971-10-01T00:00:00.000000000', '1973-09-01T00:00:00.000000000', '1975-08-01T00:00:00.000000000', '1977-06-01T00:00:00.000000000', '1979-04-01T00:00:00.000000000', '1981-03-01T00:00:00.000000000', '1983-02-01T00:00:00.000000000', '1985-01-01T00:00:00.000000000', '1987-01-01T00:00:00.000000000', '1988-10-01T00:00:00.000000000', '1990-09-01T00:00:00.000000000', '1992-09-01T00:00:00.000000000', '1994-08-01T00:00:00.000000000', '1996-07-01T00:00:00.000000000', '1998-06-01T00:00:00.000000000', '2000-04-01T00:00:00.000000000', '2002-03-01T00:00:00.000000000', '2004-02-01T00:00:00.000000000', '2006-01-01T00:00:00.000000000', '2008-01-01T00:00:00.000000000', '2009-10-01T00:00:00.000000000', '2011-10-01T00:00:00.000000000', '2013-09-01T00:00:00.000000000', '2015-07-01T00:00:00.000000000'], dtype='datetime64[ns]') Attributes: standard_name: time axis: T calendar: standard note: Time represents the first day of the referenced month (e....
09-21
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值