gpt4 book ai didi

android - SimpleDateFormat 解析器

转载 作者:太空宇宙 更新时间:2023-11-03 10:47:25 25 4
gpt4 key购买 nike

我需要将日期从这种格式转换:Tue Dec 10 09:00:00 EET 2013 到 3 12 2013 09:00

我试过类似的方法:

SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm");
Date newdata = dateFormat.parse(pubDate);
SimpleDateFormat desiredDateFormat = new SimpleDateFormat("dd-MM-yyyy, hh:mm");
this.pubDate = desiredDateFormat.parse(desiredDateFormat.format(newdata));

但日期没有改变。我怎样才能做到这一点?谢谢!

最佳答案

这条简单的线将解决你的问题

android.text.format.DateFormat dateFormat= new android.text.format.DateFormat();
dateFormat.format("dd-MM-yyyy hh:mm", new java.util.Date());

关于android - SimpleDateFormat 解析器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20606955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com