Java将时间格式化为分钟 [英] Java formatting the time to look like minutes
问题描述
hi
我有一个吸气剂
hi
I have a getter
public int getTime() {
return time;
}
和当时的二传手
and a setter for the time
public void setTime(int t) {
time = t;
}
哪一个以及如何更改它们以便
正确的格式为会显示分钟数吗?
例如,我有243
但我想要的是2.43
有人能帮帮我吗?
我尝试过的事情:
我试过substring()无效..
Which one and how do I change them so that
the proper format for minutes is displayed?
For example, I have 243
but what I wan ist 2.43
Is anyone able to help me?
What I have tried:
I have tried substring() to no avail..
推荐答案
哪一个以及如何更改它们以便显示分钟的正确格式
?
Which one and how do I change them so that
the proper format for minutes is displayed?
它们都不是。 '正确的格式'是 UI
的东西。实际值不是 UI
。定义其他方法以正确格式化值。
那么,时间
计量单位是多少?你什么都没说。
None of them. The 'proper format' is a UI
thing. The actual value is not a UI
thing. Define other methods to properly format the value.
By the way, what is the time
unit of measure? You said nothing about that.
使用其中一个内置类: java.time(Java Platform SE 8) [ ^ ]。
use one of the built in classes: java.time (Java Platform SE 8 )[^].
这篇关于Java将时间格式化为分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!