dateIsWithinDays

boolean sutil.dateIsWithinDays ( Date date1, Date date2, int days ) (professional and enterprise editions only)

Description

Checks to see if one date is within a certain number of days of another.

Parameters

  • date1 The first date.
  • date2 The second date.
  • days The maximum number of days that can be between the two dates.

Return Values

  • True if the dates are close than or the number of days apart, false otherwise.

Change Log

Version Description
5.5.13a Available in all editions.

Examples

Check the proximity of one date to another

date1 = sutil.convertStringToDate( "2012-02-15", "yyyy-MM-dd" );
date2 = sutil.convertStringToDate( "2012-02-24", "yyyy-MM-dd" );

days = 5;
session.log( "First date is within 5 days of second date: " + sutil.dateIsWithinDays( date1, date2, days ) );

days = 15;
session.log( "First date is within 15 days of second date: " + sutil.dateIsWithinDays( date1, date2, days ) );(