Created
February 16, 2016 11:38
-
-
Save ckurtm/2a8cef3c7c809c4e256e to your computer and use it in GitHub Desktop.
Revisions
-
ckurtm created this gist
Feb 16, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ LocalDateTime ldt = LocalDateTime.now(); int ld = ldt.getDayOfMonth(); int lm = ldt.getMonthValue(); int ly = ldt.getYear(); Log.d(TAG,"3ten : "+ldt.toString()); Log.d(TAG,"3ten : [day: "+ld+"] [month: "+lm+"] [year: "+ly+"]"); Log.d(TAG,"3ten : [day: "+ldt.getDayOfWeek().name()+"] [month: "+ldt.getMonth().name()+"] [year: "+ldt.getYear()+"]"); ldt.withYear(2000); ldt.plusHours(2); Log.d(TAG,"3ten : " +ldt.toString()); String frenchShortName = ldt.getMonth().getDisplayName(TextStyle.SHORT,Locale.FRENCH); boolean isLeapYear = false; // could not find a matching function LocalDateTime rounded = ldt.truncatedTo(ChronoUnit.DAYS); Log.d(TAG,"3ten : [french Short: "+frenchShortName+"] [leapyear: "+isLeapYear+"] [rounded: "+rounded+"]"); ldt = LocalDateTime.of(2005, 3, 26, 12, 0, 0, 0); Log.d(TAG,"3ten : "+ ldt.toString()); LocalDateTime plusPeriod = ldt.plusDays(1); Log.d(TAG,"3ten : +1day: "+ plusPeriod.toString()); LocalDateTime plusDuration = ldt.plus(24,ChronoUnit.HOURS); Log.d(TAG,"3ten : +24h : "+ plusDuration.toString()); LocalDateTime today = LocalDateTime.now(); LocalDateTime yesterday = today.minusDays(1); org.threeten.bp.Duration diff = org.threeten.bp.Duration.between(today,yesterday); Log.d(TAG,"3ten : hours between "+ diff.toHours());