I'm trying to find the sum of two periods of Joda Period. In one period, the current date and time is stored, and in the second interval.
First period date - current date and time
Date ddate = new Date(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Period date = new Period(fin.parsePeriod(dateFormat.format(ddate))); The second interval interval is the time interval of the format yyyy-MM-dd HH: mm: ss
Period interval = new Period(); //0000-00-20 11:50:00 interval = interval.plusDays(20); interval = interval.plusHours(11); interval = interval.plusMinutes(50); I add interval to date .
date = date.plus(interval); date = date.normalizedStandard(PeriodType.yearMonthDayTime()); For example, 2017-03-14 15:18:13 + 0000-00-20 11:50:00 = 2017-04-04 03:08:13 (sort of like)
But with the conclusion of this: 2017-03-35 03:08:13
How to deal with overflow? Or maybe there is another, more correct and concise approach to the task?