¡GoConqr estrena diseño! Cuéntanos qué te parece.

Módulo 2 de 5 · Texto

Calculation of the difference between dates

Brenda Gabriela Senra da Silva

🧠 Super resumo mental

Duration → small units (hours/minutes)
Period → big units (years/months/days)

✅ Duration

Duration measures time in:

  • hours

  • minutes

  • seconds

It is used with:

  • LocalTime

  • LocalDateTime

👉 Think of Duration as clock-based time.

Example:

Duration.between(start, end);

It calculates how much time passed between two times.

 

✅ Period

Period measures time in:

  • years

  • months

  • days

It is used with:

  • LocalDate

👉 Think of Period as calendar-based time.

Example:

Period.between(startDate, endDate);

It calculates the difference in years, months, and days.

Instrucciones

Para avanzar en el curso, envía un intento de este test. Puedes enviarlo después de la última pregunta.

Ir al módulo elegido

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?