+ 1

Java date: calculate age

How can calculate my age in years,month,weeks,days,hour,second in Java code?

2nd Aug 2019, 9:37 PM
Ali Mustafa
Ali Mustafa - avatar
1 ответ
+ 5
Basically you create two LocalDateTime objects, one for now and one for the birth datetime. You can calculate the period between two LocalDateTimes with ChronoUnit.
3rd Feb 2020, 5:25 PM
Tashi N
Tashi N - avatar