1 16 package org.joda.time.format; 17 18 33 public class PeriodFormat { 34 35 36 private static PeriodFormatter cEnglishWords; 37 38 43 protected PeriodFormat() { 44 super(); 45 } 46 47 56 public static PeriodFormatter getDefault() { 57 if (cEnglishWords == null) { 58 String [] variants = {" ", ",", ",and ", ", and "}; 59 cEnglishWords = new PeriodFormatterBuilder() 60 .appendYears() 61 .appendSuffix(" year", " years") 62 .appendSeparator(", ", " and ", variants) 63 .appendMonths() 64 .appendSuffix(" month", " months") 65 .appendSeparator(", ", " and ", variants) 66 .appendWeeks() 67 .appendSuffix(" week", " weeks") 68 .appendSeparator(", ", " and ", variants) 69 .appendDays() 70 .appendSuffix(" day", " days") 71 .appendSeparator(", ", " and ", variants) 72 .appendHours() 73 .appendSuffix(" hour", " hours") 74 .appendSeparator(", ", " and ", variants) 75 .appendMinutes() 76 .appendSuffix(" minute", " minutes") 77 .appendSeparator(", ", " and ", variants) 78 .appendSeconds() 79 .appendSuffix(" second", " seconds") 80 .appendSeparator(", ", " and ", variants) 81 .appendMillis() 82 .appendSuffix(" millisecond", " milliseconds") 83 .toFormatter(); 84 } 85 return cEnglishWords; 86 } 87 88 } 89 | Popular Tags |