Joda-Time,没有约会的时间 [英] Joda-Time, Time without date

查看:122
本文介绍了Joda-Time,没有约会的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个只存储时间而不是日期或日期的类。在Joda-Time有一个课吗?或者我是否必须使用日期时间并仅将时间部分转换为字符串然后使用该部分?

I want a Class that only stores the time and not the date or day. Is there a class for this in Joda-Time ? or do I have to use a Date time and convert only the time part into a string and then use that part ?

推荐答案

这里有 LocalTime 用于此目的的课程。

There's the LocalTime class for that purpose.

了解更多关于偏在这里。例如:

LocalTime time = new LocalTime(12, 20);
String formatted = time.toString("HH:mm");

这篇关于Joda-Time,没有约会的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆