static public DateTimePeriod create ( DateTimeDuration duration , DateTime start ) { if ( duration == DateTimeDuration . YEAR ) { return createYear ( start ) ; } else if ( duration == DateTimeDuration . MONTH ) { return createMonth ( start ) ; } else if ( duration == DateTimeDuration . DAY ) { return createDay ( start ) ; } else if ( duration == DateTimeDuration . HOUR ) { return createHour ( start ) ; } else if ( duration == DateTimeDuration . FIVE_MINUTES ) { return createFiveMinutes ( start ) ; } else { throw new UnsupportedOperationException ( "Duration " + duration + " not yet supported" ) ; } }
Creates a new period for the specified duration starting from the provided DateTime .