Class BwDateTimeUtil

java.lang.Object
org.bedework.calfacade.util.BwDateTimeUtil

public class BwDateTimeUtil extends Object
Date and time utilities
Version:
1.0
Author:
Mike Douglass douglm - bedework.edu
  • Method Details

    • getDate

      public static Date getDate(BwDateTime val) throws CalFacadeBadDateException
      Get a java.util.Date object from the value XXX - this will neeed to be supplied with a tz repository
      Parameters:
      val - bw date time object
      Returns:
      Date object representing the date
      Throws:
      CalFacadeBadDateException - on bad date
    • getDate

      public static Date getDate(BwDateTime val, net.fortuna.ical4j.model.TimeZoneRegistry tzreg) throws CalFacadeBadDateException
      Get a java.util.Date object from the value
      Parameters:
      val - bw date time object
      tzreg - registry
      Returns:
      Date object representing the date
      Throws:
      CalFacadeBadDateException - on bad date
    • getDateTime

      public static BwDateTime getDateTime(Date date)
      Get a date/time object representing the given date and time
      Parameters:
      date - Java Date object
      Returns:
      BwDateTime object representing the date
    • getDateTime

      public static BwDateTime getDateTime(String date, boolean dateOnly, boolean floating, String tzid)
      Get a date object representing the given date and flags
      Parameters:
      date - String iso date or date/time
      dateOnly - true for date-only value
      floating - boolean true if this is a floating time
      tzid - - String tzid or null for default, UTC or floating.
      Returns:
      Date object representing the date
      Throws:
      RuntimeException - on timezone error or bad date
    • getDateTimeUTC

      public static BwDateTime getDateTimeUTC(String date)
      Get a date object representing the given String UTC date/time
      Parameters:
      date - UTC date time value
      Returns:
      BwDateTime object representing the date
    • getPeriod

      public static BwTimeRange getPeriod(String start, String end, int defaultField, int defaultVal, int maxField, int maxVal) throws CalFacadeException
      Get a date/time range given by the rfc formatted parameters and limited to the given max range
      Parameters:
      start - date or date/time
      end - date or date/time
      defaultField - Calendar field id
      defaultVal - value for field
      maxField - Calendar field id
      maxVal - - 0 for no max
      Returns:
      TimeRange or null for bad request
      Throws:
      CalFacadeException - on bad date