Here you can find the source of getHoursElapsed(LocalDateTime fromDate)
public static long getHoursElapsed(LocalDateTime fromDate)
//package com.java2s; //License from project: Apache License import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; public class Main { public static long getHoursElapsed(LocalDateTime fromDate) { return fromDate.until(LocalDateTime.now(), ChronoUnit.HOURS); }// w w w .j a va 2s. c o m }