1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > java date 日期格式_如何将JAVA DATE类型的日期 转换成指定格式类型的 (如:YYY

java date 日期格式_如何将JAVA DATE类型的日期 转换成指定格式类型的 (如:YYY

时间:2022-11-11 23:58:49

相关推荐

java date 日期格式_如何将JAVA DATE类型的日期 转换成指定格式类型的 (如:YYY

展开全部

Date类型并没有格式32313133353236313431303231363533e58685e5aeb931333433653262,只有转换成String格式的时候让格式化显示。

new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")format(new Date());

Calendar calendar = Calendar.getInstance();

int year = Integer.parseInt(datetime.substring(0,4));

int month = Integer.parseInt(datetime.substring(5,7));

int date = Integer.parseInt(datetime.substring(8,10));

int hour = Integer.parseInt(datetime.substring(11,13));

int minute = Integer.parseInt(datetime.substring(14,16));

//int second = Integer.parseInt(datetime.substring(17,19));

if(calendar.get(Calendar.YEAR)>year){

int y = calendar.get(Calendar.YEAR)-year;

扩展资料:

Date类可以在ja

java date 日期格式_如何将JAVA DATE类型的日期 转换成指定格式类型的 (如:YYYY-MM-DD) 的 DATE类型数据?...

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。