mysql中todays
Duration Class toDays()方法 (Duration Class toDays() method)
toDays() method is available in java.time package.
toDays()方法在java.time包中可用。
toDays() method is used to convert this Duration into the number of days.
toDays()方法用于将此持续时间转换为天数。
toDays() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
toDays()方法是一种非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。
toDays() method does not throw an exception at the time of converting this Duration to days.
在将此持续时间转换为天数时, toDays()方法不会引发异常。
Syntax:
句法:
public Temporal subtractFrom(Temporal temp);
Parameter(s):
参数:
None
没有
Return value:
返回值:
The return type of this method is long, it returns the number of days exists in this Duration.
此方法的返回类型为long ,它返回此Duration中存在的天数。
Example:
例:
// Java program to demonstrate the example
// of long toDays() method of Duration
import java.time.*;
public class ToDaysOfDuration {
public static void main(String args[]) {
// Instantiates two Duration objects
Duration du1 = Duration.ofHours(72);
Duration du2 = Duration.parse("P0DT48H");
// Display du1 and du2
System.out.println("du1: " + du1);
System.out.println("du2: " + du2);
// represents this Duration du1 in hours into
// number of days i.e. 72H = 3 days
long to_days = du1.toDays();
// Display to_days
System.out.println("du1.toDays(): " + to_days);
// represents this Duration du2 in hours into
// number of days i.e. 78H = 2 days
to_days = du2.toDays();
// Display to_days
System.out.println("du2.toDays(): " + to_days);
}
}
Output
输出量
du1: PT72H
du2: PT48H
du1.toDays(): 3
du2.toDays(): 2
翻译自: https://www.includehelp.com/java/duration-todays-method-with-example.aspx
mysql中todays