i want learn remaining time to 18.30 in my Android application. But,in joda time code there are year, month and day. i want use joda time for remaining time without date.
My code is not refresing remaining time for another days and remaning time is negative value when date and time passed. So, i want remove date values.
DateTime startDate = DateTime.now(); // now() : since Joda Time 2.0
DateTime endDate = new DateTime(2014, 10, 30, 18, 30);
Period period = new Period(startDate, endDate, PeriodType.dayTime());
PeriodFormatter formatter = new PeriodFormatterBuilder()
.appendDays().appendSuffix(" day ", " days ")
.appendHours().appendSuffix(" hour ", " hours ")
.appendMinutes().appendSuffix(" minute ", " minutes ")
.appendSeconds().appendSuffix(" second ", " seconds ")
.toFormatter();
tw.setText(formatter.print(period));
i explained at http://i.imgur.com/YEjIGFz.png
0 comments:
Post a Comment