LocalDateTime minusHours(long hours) example
Description
LocalDateTime minusHours(long hours)
returns a copy of this LocalDateTime with the specified period in hours subtracted.
Syntax
minusHours
has the following syntax.
public LocalDateTime minusHours(long hours)
Example
The following example shows how to use minusHours
.
import java.time.LocalDateTime;
// ww w . jav a 2 s . c o m
public class Main {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00);
LocalDateTime t = a.minusHours(100);
System.out.println(t);
}
}
The code above generates the following result.