com.ibm.icu.util.Calendar Java Examples

The following examples show how to use com.ibm.icu.util.Calendar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TimeMemberUtil.java    From birt with Eclipse Public License 1.0 7 votes vote down vote up
private static MemberTreeNode[] createQuarterNode( )
{
	MemberTreeNode[] nodes = new MemberTreeNode[4];
	calendar.clear( );
	for ( int i = 1; i <= nodes.length; i++ )
	{
		Member member = new Member( );
		member.setKeyValues( new Object[]{
			Integer.valueOf( i )
		} );
		calendar.set( Calendar.MONTH, ( i-1 )*3 );
		member.setAttributes( new Object[]{
				calendar.getTime( )
			} );
		nodes[i - 1] = new MemberTreeNode( member );
	}
	return nodes;
}
 
Example #2
Source File: DateTimeConverters.java    From scipio-erp with Apache License 2.0 6 votes vote down vote up
public Calendar convert(String obj, Locale locale, TimeZone timeZone, String formatString) throws ConversionException {
    String trimStr = obj.trim();
    if (trimStr.length() == 0) {
        return null;
    }
    DateFormat df = null;
    if (UtilValidate.isEmpty(formatString)) {
        df = UtilDateTime.toDateTimeFormat(UtilDateTime.getDateTimeFormat(), timeZone, locale);
    } else {
        df = UtilDateTime.toDateTimeFormat(formatString, timeZone, locale);
    }
    try {
        java.util.Date date = df.parse(trimStr);
        return UtilDateTime.toCalendar(date, timeZone, locale);
    } catch (ParseException e) {
        throw new ConversionException(e);
    }
}
 
Example #3
Source File: DateIntervalInfo.java    From fitnotifications with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the pattern letter
 * @param patternLetter
 * @return Pattern letter
 */
private CharSequence validateAndProcessPatternLetter(CharSequence patternLetter) {
    // Check that patternLetter is just one letter
    if (patternLetter.length() != 1) { return null; }

    // Check that the pattern letter is accepted
    char letter = patternLetter.charAt(0);
    if (ACCEPTED_PATTERN_LETTERS.indexOf(letter) < 0) {
        return null;
    }

    // Replace 'h' for 'H'
    if (letter == CALENDAR_FIELD_TO_PATTERN_LETTER[Calendar.HOUR_OF_DAY].charAt(0)) {
        patternLetter = CALENDAR_FIELD_TO_PATTERN_LETTER[Calendar.HOUR];
    }

    return patternLetter;
}
 
Example #4
Source File: TemporalExpressions.java    From scipio-erp with Apache License 2.0 6 votes vote down vote up
@Override
public boolean includesDate(Calendar cal) {
    int minute = cal.get(Calendar.MINUTE);
    if (minute == this.start || minute == this.end) {
        return true;
    }
    Calendar compareCal = (Calendar) cal.clone();
    compareCal.set(Calendar.MINUTE, this.start);
    while (compareCal.get(Calendar.MINUTE) != this.end) {
        if (compareCal.get(Calendar.MINUTE) == minute) {
            return true;
        }
        compareCal.add(Calendar.MINUTE, 1);
    }
    return false;
}
 
Example #5
Source File: CmsAccessHandler.java    From scipio-erp with Apache License 2.0 6 votes vote down vote up
public static void cleanupUserAccessTokens(GenericValue userLogin, String pageId, Timestamp nowTimestamp) {
    if (userLogin == null) {
        return;
    }
    Delegator delegator = userLogin.getDelegator();
    if (nowTimestamp == null) {
        nowTimestamp = UtilDateTime.nowTimestamp();
    }
    String userId = userLogin.getString("userLoginId");
    List<EntityCondition> conds = UtilMisc.toList(EntityCondition.makeCondition("userId", userId),
            EntityCondition.makeCondition("createdDate", EntityOperator.LESS_THAN, UtilDateTime.adjustTimestamp(nowTimestamp, Calendar.SECOND, -TOKEN_EXPIRY)));
    if (pageId != null) {
        conds.add(EntityCondition.makeCondition("pageId", userLogin.get("pageId")));
    }
    List<GenericValue> tokens = delegator.from("CmsAccessToken").where(conds).queryListSafe();
    if (UtilValidate.isEmpty(tokens)) {
        return;
    }
    Debug.logInfo("Cms: cleanupUserAccessTokens: Removing " + tokens.size() + " expired access tokens for user '"
            + userId + "'" + (pageId != null ? " for page '" + pageId + "'" : ""), module);
    try {
        delegator.removeAll(tokens);
    } catch (GenericEntityException e) {
        Debug.logError(e, module);
    }
}
 
Example #6
Source File: DateTime.java    From org.openntf.domino with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isAfterIgnoreTime(final org.openntf.domino.DateTime compareDate) {
	Calendar cal = calendar.get();
	cal.setTime(date_);
	cal.set(Calendar.HOUR_OF_DAY, 0);
	cal.set(Calendar.MINUTE, 0);
	cal.set(Calendar.SECOND, 0);
	cal.set(Calendar.MILLISECOND, 0);
	Date d1 = cal.getTime();
	cal.setTime(compareDate.toJavaDate());
	cal.set(Calendar.HOUR_OF_DAY, 0);
	cal.set(Calendar.MINUTE, 0);
	cal.set(Calendar.SECOND, 0);
	cal.set(Calendar.MILLISECOND, 0);
	Date d2 = cal.getTime();
	return d1.after(d2);
}
 
Example #7
Source File: DateTimeFunctions.java    From org.openntf.domino with Apache License 2.0 6 votes vote down vote up
private static int calcBusDays(final FormulaContext ctx, DateTime sdtFrom, DateTime sdtTo, final boolean[] excludeDays,
		final TreeSet<DateTime> excludeDates) {
	sdtFrom = getSDTCopy(ctx, sdtFrom);
	sdtFrom.setAnyTime();
	if (!sdtTo.isAnyTime()) {
		sdtTo = getSDTCopy(ctx, sdtTo);
		sdtTo.setAnyTime();
	}
	if (sdtFrom.compare(sdtFrom, sdtTo) > 0)
		return -1;
	int ret = 0;
	do {
		if (!excludeDays[sdtFrom.toJavaCal().get(Calendar.DAY_OF_WEEK)] && !excludeDates.contains(sdtFrom))
			ret++;
		sdtFrom.adjustDay(1);
	} while (sdtFrom.compare(sdtFrom, sdtTo) <= 0);
	return ret;
}
 
Example #8
Source File: DateTimeFormatObject.java    From es6draft with MIT License 6 votes vote down vote up
private DateFormat createDateFormat() {
    ULocale locale = ULocale.forLanguageTag(this.locale);
    // calendar and numberingSystem are already handled in language-tag
    // assert locale.getKeywordValue("calendar").equals(calendar);
    // assert locale.getKeywordValue("numbers").equals(numberingSystem);
    SimpleDateFormat dateFormat = new SimpleDateFormat(pattern.get(), locale);
    if (timeZone != null) {
        dateFormat.setTimeZone(TimeZone.getTimeZone(timeZone));
    }
    Calendar calendar = dateFormat.getCalendar();
    if (calendar instanceof GregorianCalendar) {
        // format uses a proleptic Gregorian calendar with no year 0
        GregorianCalendar gregorian = (GregorianCalendar) calendar;
        gregorian.setGregorianChange(new Date(Long.MIN_VALUE));
    }
    return dateFormat;
}
 
Example #9
Source File: BirtDateTime.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Return difference in number of days
 *
 * @param d1
 * @param d2
 * @return
 */
private static long diffDay( Date d1, Date d2 )
{
	Calendar c1 = Calendar.getInstance( threadTimeZone.get( ) );
	c1.setTime( d1 );
	Calendar c2 = Calendar.getInstance( threadTimeZone.get( ) );
	c2.setTime( d2 );
	if ( c1.after( c2 ) )
	{
		return -diffDay( c2, c1 ) ;
	}
	else
	{
		return diffDay( c1, c2 );
	}
}
 
Example #10
Source File: MCRMetaHistoryDate.java    From mycore with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Validates this MCRMetaHistoryDate. This method throws an exception if:
 * <ul>
 * <li>the subtag is not null or empty</li>
 * <li>the lang value was supported</li>
 * <li>the inherited value is lower than zero</li>
 * <li>the number of texts is 0 (empty texts are delete)</li>
 * <li>von is null or bis is null or calendar is null</li>
 * </ul>
 * 
 * @throws MCRException the MCRMetaHistoryDate is invalid
 */
@Override
public void validate() throws MCRException {
    super.validate();
    texts.removeIf(textItem -> !textItem.isValid());
    if (texts.size() == 0) {
        throw new MCRException(getSubTag() + ": no texts defined");
    }
    if (von == null || bis == null || calendar == null) {
        throw new MCRException(getSubTag() + ": von,bis or calendar are null");
    }
    if (ibis < ivon) {
        Calendar swp = (Calendar) von.clone();
        setVonDate((Calendar) bis.clone());
        setBisDate(swp);
    }
}
 
Example #11
Source File: OdsUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static int getType( Object val )
{
	if ( val instanceof Number )
	{
		return SheetData.NUMBER;
	}
	else if ( val instanceof Date )
	{
		return SheetData.DATE;
	}
	else if ( val instanceof Calendar )
	{
		return SheetData.CALENDAR;
	}
	else if ( val instanceof Boolean )
	{
		return SheetData.BOOLEAN;
	}
	else
	{
		return SheetData.STRING;
	}
}
 
Example #12
Source File: DateTimeUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Return difference in number of weeks
 * 
 * @param d1
 * @param d2
 * @return
 */
 public long diffWeek( Date d1, Date d2 )
{
	Calendar calendar = getCalendarOfStartingTime( );
	
	Date baseDay = calendar.getTime( );

	int diffDay = 1 - Integer.valueOf( weekDay( baseDay ) ).intValue( );

	baseDay = addDay( baseDay, diffDay );

	return ( diffSecond( baseDay, d2 ) + 3000 * 60 * 60 * 24 * 7 )
			/ ( 60 * 60 * 24 * 7 )
			- ( diffSecond( baseDay, d1 ) + 3000 * 60 * 60 * 24 * 7 )
			/ ( 60 * 60 * 24 * 7 );
}
 
Example #13
Source File: BaseSecurityManager.java    From olat with Apache License 2.0 6 votes vote down vote up
/**
*/
  @Override
  public List<Invitation> findExpiredInvitations(Date limitDate) {
      final Date currentTime = Calendar.getInstance().getTime();
      final StringBuilder sb = new StringBuilder();
      sb.append("select invitation from ").append(InvitationImpl.class.getName()).append(" as invitation ").append(" inner join invitation.securityGroup secGroup ")
              .append(" where invitation.creationDate<=:dateLimit")
              // someone can create an invitation but not add it to a policy within millisecond
              .append(" and secGroup not in (")
              // select all valid policies from this security group
              .append("  select policy.securityGroup from ").append(PolicyImpl.class.getName()).append(" as policy ")
              .append("   where (policy.from is null or policy.from<=:currentDate)").append("   and (policy.to is null or policy.to>=:currentDate)").append("  )");

      final DBQuery query = database.createQuery(sb.toString());
      query.setTimestamp("currentDate", currentTime);
      query.setTimestamp("dateLimit", limitDate);
      @SuppressWarnings("unchecked")
      final List<Invitation> oldInvitations = query.list();
      return oldInvitations;
  }
 
Example #14
Source File: BirtDateTime.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Day the week. Option is an integer value: 1: return a number 1 (Sunday)
 * to 7 (Saturday) 2: return a number 1 (Monday) to 7 (Sunday) 3: return a
 * number 0 (Monday) to 6 (Sunday) 4: return the weekday name as per user
 * locale (e.g., Sunday Saturday for English) 5: return the abbreviated
 * weekday name as per user locale (e.g., Sun Sat for English)
 *
 * @param d
 * @param option
 * @return
 */
private static String weekDay( Date d, int option )
{
	if ( d == null )
		throw new java.lang.IllegalArgumentException( Messages.getString( "error.BirtDateTime.cannotBeNull.DateValue" ) );
	switch ( option )
	{
		case 1 :
			return String.valueOf( getWeekDay( d, Calendar.SUNDAY ) );
		case 2 :
			return String.valueOf( getWeekDay( d, Calendar.MONDAY ) );
		case 3 :
			return String.valueOf( getWeekDay( d, Calendar.MONDAY ) - 1 );
		case 4 :
			return getWeekFormat().format( d );
		case 5 :
			return getAbbrWeekFormat().format( d );
	}
	return null;

}
 
Example #15
Source File: TrailingFunction.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Check if date1 is in the same time period ( month/ year ) with date2.
 * If not, return date1, else return null.
 * @param date1
 * @param date2
 * @param extraWeekLevel
 * @return
 */
private Calendar getExtraWeek(Calendar date1, Calendar date2,
		String extraWeekLevel) {
	
	if ( extraWeekLevel.equals( TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH ) )
	{
		if ( date1.get( Calendar.MONTH ) != date2.get( Calendar.MONTH ) )
			return date1;
	}
	if ( extraWeekLevel.equals( TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR ) )
	{
		if ( date1.get( Calendar.YEAR ) != date2.get( Calendar.YEAR ) )
			return date1;
	}
	
	return null;
}
 
Example #16
Source File: BirtDateTime.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Object getValue( Object[] args ) throws BirtException
{
	if( existNullValue( args ) )
	{
		return null;
	}
	Date date = DataTypeUtil.toDate(args[0]);
	Calendar cal = getCalendar( date );
	int quarter = quarter( date );

	cal.set( Calendar.MONTH, ( quarter - 1 ) * 3 );
	cal.set( Calendar.DAY_OF_MONTH, 1 );
	return cal.getTime( );
}
 
Example #17
Source File: BirtDateTime.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Object getValue( Object[] args, IScriptFunctionContext context ) throws BirtException
{
	if ( existNullValue( args ) )
	{
		return null;
	}
	Calendar current = getCalendar( DataTypeUtil.toDate( args[0] ) );
	Calendar start = getFiscalYearStateDate( context, args );
	adjustFiscalYear( current, start );
	return current.get( Calendar.DAY_OF_YEAR );
}
 
Example #18
Source File: MCRMODSDateHelperTest.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testISO8601Date() {
    String date = "20110929";
    Element element = new Element("date").setText(date);

    GregorianCalendar parsed = MCRMODSDateHelper.getCalendar(element);
    assertEquals(2011, parsed.get(Calendar.YEAR));
    assertEquals(9 - 1, parsed.get(Calendar.MONTH));
    assertEquals(29, parsed.get(Calendar.DAY_OF_MONTH));

    MCRMODSDateHelper.setDate(element, parsed, MCRMODSDateFormat.iso8601_8);
    assertEquals("iso8601", element.getAttributeValue("encoding"));
    assertEquals(date, element.getText());
}
 
Example #19
Source File: PortfolioCourseNodeRunController.java    From olat with Apache License 2.0 5 votes vote down vote up
private boolean applyRelativeToDate(final Calendar cal, final String time, final int calTime, final int factor) {
    final String t = (String) config.get(time);
    if (StringHelper.containsNonWhitespace(t)) {
        int timeToApply;
        try {
            timeToApply = Integer.parseInt(t) * factor;
        } catch (final NumberFormatException e) {
            log.warn("Not a number: " + t, e);
            return false;
        }
        cal.add(calTime, timeToApply);
        return true;
    }
    return false;
}
 
Example #20
Source File: ChineseDateFormat.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @deprecated ICU 50
 */
@Deprecated
@Override
protected int subParse(String text, int start, char ch, int count, boolean obeyCount, boolean allowNegative,
        boolean[] ambiguousYear, Calendar cal) {
    // Logic to handle numeric 'G' eras for chinese calendar, and to skip special 2-digit year
    // handling for chinese calendar, is moved into SimpleDateFormat, so delete here.
    // Obsolete pattern char 'l' is now ignored for parsing in SimpleDateFormat, no handling
    // needed here.
    // So just use SimpleDateFormat implementation for this.
    // just use its implementation
    return super.subParse(text, start, ch, count, obeyCount, allowNegative, ambiguousYear, cal);
}
 
Example #21
Source File: UtilDateTime.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
/**
 * Makes a Date from separate ints for month, day, year, hour, minute, and second.
 *
 * @param month  The month int
 * @param day    The day int
 * @param year   The year int
 * @param hour   The hour int
 * @param minute The minute int
 * @param second The second int
 * @return A Date made from separate ints for month, day, year, hour, minute, and second.
 */
public static java.util.Date toDate(int month, int day, int year, int hour, int minute, int second) {
    Calendar calendar = Calendar.getInstance();

    try {
        calendar.set(year, month - 1, day, hour, minute, second);
        calendar.set(Calendar.MILLISECOND, 0);
    } catch (Exception e) {
        return null;
    }
    return new java.util.Date(calendar.getTime().getTime());
}
 
Example #22
Source File: BirtDateTime.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Week number of the year (1 to 52) of date/time value d.
 *
 * @param d
 * @return
 */
private static int week( Date d )
{
	if ( d == null )
		throw new java.lang.IllegalArgumentException( Messages.getString( "error.BirtDateTime.cannotBeNull.DateValue" ) );

	return getCalendar( d ).get( Calendar.WEEK_OF_YEAR );
}
 
Example #23
Source File: ExpressionUiHelper.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
/** Returns a List of Maps containing day of the week values.
 * @param locale
 * @return List of Maps. Each Map has a
 * <code>description</code> entry and a <code>value</code> entry.
 */
public static List<Map<String, Object>> getDayValueList(Locale locale) {
    Calendar tempCal = Calendar.getInstance(locale);
    tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek());
    SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE", locale);
    List<Map<String, Object>> result = new ArrayList<>(7);
    for (int i = 0; i < 7; i++) {
        result.add(UtilMisc.toMap("description", (Object)dateFormat.format(tempCal.getTime()), "value", tempCal.get(Calendar.DAY_OF_WEEK)));
        tempCal.roll(Calendar.DAY_OF_WEEK, 1);
    }
    return result;
}
 
Example #24
Source File: TemporalExpressions.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isSubstitutionCandidate(Calendar cal, TemporalExpression expressionToTest) {
    Calendar checkCal = (Calendar) cal.clone();
    checkCal.add(Calendar.HOUR_OF_DAY, -1);
    while (!includesDate(checkCal)) {
        if (expressionToTest.includesDate(checkCal)) {
            return true;
        }
        checkCal.add(Calendar.HOUR_OF_DAY, -1);
    }
    return false;
}
 
Example #25
Source File: TimeDimensionUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public static int getFieldIndex( String fieldName )
{
 if( fieldName.equals( YEAR ) )
  return Calendar.YEAR;
 else if( fieldName.equals( MONTH ) )
  return Calendar.MONTH;
 else if( fieldName.equals( WEEK_OF_YEAR ) )
  return Calendar.WEEK_OF_YEAR;
 else if( fieldName.equals( WEEK_OF_MONTH ) )
  return Calendar.WEEK_OF_MONTH;
 else if( fieldName.equals( DAY_OF_MONTH ) )
  return Calendar.DAY_OF_MONTH;
 else if( fieldName.equals( DAY_OF_YEAR ) )
  return Calendar.DAY_OF_YEAR;
 else if( fieldName.equals( DAY_OF_WEEK ) )
  return Calendar.DAY_OF_WEEK;
 else if( fieldName.equals( HOUR ) )
  return Calendar.HOUR;
 else if( fieldName.equals( HOUR_OF_DAY ) )
  return Calendar.HOUR_OF_DAY;
 else if( fieldName.equals( MINUTE ) )
  return Calendar.MINUTE;
 else if( fieldName.equals( SECOND ) )
  return Calendar.SECOND;
 else if( fieldName.equals( MILLISECOND ) )
  return Calendar.MILLISECOND;
 return -1;
}
 
Example #26
Source File: DateTimeUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Quarter number (1 to 4) of date/time value d
 * 
 * @param d
 * @return
 */
public int quarter( Date d )
{
	if ( d == null )
		throw new java.lang.IllegalArgumentException( "date value is null!" );

	int month = getCalendar( d ).get( Calendar.MONTH );
	switch ( month )
	{
		case Calendar.JANUARY :
		case Calendar.FEBRUARY :
		case Calendar.MARCH :
			return 1;
		case Calendar.APRIL :
		case Calendar.MAY :
		case Calendar.JUNE :
			return 2;
		case Calendar.JULY :
		case Calendar.AUGUST :
		case Calendar.SEPTEMBER :
			return 3;
		case Calendar.OCTOBER :
		case Calendar.NOVEMBER :
		case Calendar.DECEMBER :
			return 4;
		default :
			return -1;
	}
}
 
Example #27
Source File: DateTimePatternGenerator.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
private String getCalendarTypeToUse(ULocale uLocale) {
    // Get the correct calendar type
    // TODO: C++ and Java are inconsistent (see #9952).
    String calendarTypeToUse = uLocale.getKeywordValue("calendar");
    if ( calendarTypeToUse == null ) {
        String[] preferredCalendarTypes = Calendar.getKeywordValuesForLocale("calendar", uLocale, true);
        calendarTypeToUse = preferredCalendarTypes[0]; // the most preferred calendar
    }
    if ( calendarTypeToUse == null ) {
        calendarTypeToUse = "gregorian"; // fallback
    }
    return calendarTypeToUse;
}
 
Example #28
Source File: BirtDateTime.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private static Date getDate( int year, int month, int day, int hours,
		int minutes, int seconds )
{
	Date newDate = new Date( );
	Calendar calendar = getCalendar( newDate );
	calendar.set( year, month, day, hours, minutes, seconds );
	calendar.set( Calendar.MILLISECOND, 0 );
	return calendar.getTime( );
}
 
Example #29
Source File: TimeDuration.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
private static int advanceCalendar(Calendar start, Calendar end, int units, int type) {
    if (units >= 1) {
        // Bother, the below needs explanation.
        //
        // If start has a day value of 31, and you add to the month,
        // and the target month is not allowed to have 31 as the day
        // value, then the day will be changed to a value that is in
        // range.  But, when the code needs to then subtract 1 from
        // the month, because it has advanced to far, the day is *not*
        // set back to the original value of 31.
        //
        // This bug can be triggered by having a duration of -1 day,
        // then adding this duration to a calendar that represents 0
        // milliseconds, then creating a new duration by using the 2
        // Calendar constructor, with cal1 being 0, and cal2 being the
        // new calendar that you added the duration to.
        //
        // To solve this problem, we make a temporary copy of the
        // start calendar, and only modify it if we actually have to.
        Calendar tmp = (Calendar) start.clone();
        int tmpUnits = units;
        tmp.add(type, tmpUnits);
        while (tmp.after(end)) {
            tmp.add(type, -1);
            units--;
        }
        if (units != 0) {
            start.add(type, units);
        }
    }
    return units;
}
 
Example #30
Source File: BirtDateTime.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private static Calendar getFiscalYearStateDate(
		IScriptFunctionContext context, Object[] args ) throws BirtException
{
	if ( args.length > 1 )
	{
		return getCalendar( DataTypeUtil.toDate( args[1] ) );
	}
	return getDefaultFiscalYearStartDate( context );
}