I want to compute the duration between 2 timestamp variables and output in HH:MM:SS format
val start_time = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now)
val sourceFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
val start_time_dt = sourceFormat.parse(start_time)
val end_time = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now)
val end_time_dt = sourceFormat.parse(end_time)
I am trying to do this:
Duration.between(end_time_dt, start_time_dt)
but I am getting the below error:
found : java.util.Date
required: java.time.temporal.Temporal