public static CalendarDuration fromUnitString(String unitString) { return new CalendarDuration(1, CalendarPeriod.fromUnitString(unitString)); }
static public void main(String args[]) throws Exception { test("sec", "PT1S"); test("secs", "PT1S"); test("minute", "PT1M"); test("minutes", "PT1M"); test("hour", "PT1H"); test("hours", "PT1H"); test("hr", "PT1H"); test("day", "P1D"); test("days", "P1D"); test("week", "P7D"); test("weeks", "P7D"); test("month", "P1M"); test("months", "P1M"); test("year", "P1Y"); test("years", "P1Y"); }
/** * String representation * @return getText() */ public String toString() { return getText(); }
buff.append(" <li><em> Duration: </em> ").append(StringUtil2.quoteHtmlContent(duration.toString())).append("\n"); CalendarDuration resolution = tc.getResolution(); if (resolution != null) { buff.append(" <li><em> Resolution: </em> ").append(StringUtil2.quoteHtmlContent(resolution.toString())).append("\n");
if ((duration != null) && !duration.isBlank()) buff.append(" <li><em> Duration: </em> ").append(StringUtil2.quoteHtmlContent(duration.toString())).append("\n"); CalendarDuration resolution = tc.getResolution(); if (resolution != null && !resolution.isBlank()) { buff.append(" <li><em> Resolution: </em> ").append(StringUtil2.quoteHtmlContent(resolution.toString())).append("\n");
static private void test(String unit, String result) throws Exception { org.joda.time.Period jp = convertToPeriod(1, unit); assert jp != null; System.out.printf("%s == %s%n", unit, jp); assert jp.toString().equals(result) : jp.toString()+" != "+ result; }
buff.append(" <li><em> Duration: </em> ").append(StringUtil2.quoteHtmlContent(duration.toString())).append("\n"); CalendarDuration resolution = tc.getResolution(); if (resolution != null) { buff.append(" <li><em> Resolution: </em> ").append(StringUtil2.quoteHtmlContent(resolution.toString())).append("\n");
static private void test(String unit, String result) throws Exception { org.joda.time.Period jp = convertToPeriod(1, unit); assert jp != null; System.out.printf("%s == %s%n", unit, jp); assert jp.toString().equals(result) : jp.toString()+" != "+ result; }
drElem.addContent(new Element("end").addContent(dateRange.getEnd().toString())); if (dateRange.getResolution() != null) drElem.addContent(new Element("resolution").addContent(dateRange.getResolution().toString()));
static private void test(String unit, String result) throws Exception { org.joda.time.Period jp = convertToPeriod(1, unit); assert jp != null; System.out.printf("%s == %s%n", unit, jp); assert jp.toString().equals(result) : jp.toString()+" != "+ result; }
public static CalendarDuration fromUnitString(String unitString) { return new CalendarDuration(1, CalendarPeriod.fromUnitString(unitString)); }
static public void main(String args[]) throws Exception { test("sec", "PT1S"); test("secs", "PT1S"); test("minute", "PT1M"); test("minutes", "PT1M"); test("hour", "PT1H"); test("hours", "PT1H"); test("hr", "PT1H"); test("day", "P1D"); test("days", "P1D"); test("week", "P7D"); test("weeks", "P7D"); test("month", "P1M"); test("months", "P1M"); test("year", "P1Y"); test("years", "P1Y"); }
drElem.addContent(new Element("end").addContent(dateRange.getEnd().toString())); if (dateRange.getResolution() != null) drElem.addContent(new Element("resolution").addContent(dateRange.getResolution().toString()));
public static CalendarDuration fromUnitString(String unitString) { return new CalendarDuration(1, CalendarPeriod.fromUnitString(unitString)); }
static public void main(String args[]) throws Exception { test("sec", "PT1S"); test("secs", "PT1S"); test("minute", "PT1M"); test("minutes", "PT1M"); test("hour", "PT1H"); test("hours", "PT1H"); test("hr", "PT1H"); test("day", "P1D"); test("days", "P1D"); test("week", "P7D"); test("weeks", "P7D"); test("month", "P1M"); test("months", "P1M"); test("year", "P1Y"); test("years", "P1Y"); }
drElem.addContent(new Element("end").addContent(dateRange.getEnd().toString())); if (dateRange.getResolution() != null) drElem.addContent(new Element("resolution").addContent(dateRange.getResolution().toString()));