code: 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");
          }
      }
docs: Creates a new period for the specified duration starting from the
  provided DateTime.
  @param duration The duration for this period such as Month, Hour, etc.
  @param start The DateTime to start this period from
  @return A new period