Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
NAB - 'Not Another Button'
cXtraVideoCapture
Color Fader-Alphamania
Quit Message
Relative Links
Stamper Sprite
Anatomy of an Alpha Channel
Open MIAW
Effector Set II for Alphamania
XTRA dmmScript for scripting
 

 

 

Behavior Check valid date

Added on 6/22/1999

 

Compatibilities:
D7 D8 Mac PC Script Shockwave

This item has not yet been rated

Author: MediaMacros (website)

All to compare if a date is between 2 other dates. Use day/month/year format. Delimiter is the character separating each part.

--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know.  :-)

on checkTheDate checkDate, startDate, endDate, delimiter
  the itemDelimiter = delimiter  
  theYear = 3
  theMonth = 2
  theDay = 1
  dateList = [checkDate, startDate, endDate]
  --correct any date input errors
  repeat with x = 1 to dateList.count
    --the year
    thisYear = (dateList[x]).item[theYear]
    if integer(thisYear) = void then
      alert "Incorrect Year typed passed.  Value must be a number.  Use 4 digit Years."
      exit
    end if
    if thisYear.char.count < 4 then
      if integer(thisYear) > 50 then
        thisYear = string(integer(thisYear) + 1900)
      else
        thisYear = string(integer(thisYear) + 2000)
      end if
    else if thisYear.char.count > 4 then
      alert "Incorrect Year typed passed.  Too many digits.  Use 4 digit Years."
      exit
    end if
    --the month    
    thisMonth = (dateList[x]).item[theMonth]
    if integer(thisMonth) = void then
      case thisMonth of
        "Jan", "January" : thisMonth = "01"
        "Feb", "February" : thisMonth = "02"
        "Mar", "March" : thisMonth = "03"
        "Apr", "April" : thisMonth = "04"
        "May" : thisMonth = "05"
        "Jun", "June" : thisMonth = "06"
        "Jul", "July" : thisMonth = "07"
        "Aug", "August" : thisMonth = "08"
        "Sep", "Sept", "September" : thisMonth = "09"
        "Oct", "October" : thisMonth = "10"
        "Nov", "November", "Novem" : thisMonth = "11"
        "Dec", "Decem", "December" : thisMonthe = "12"
        otherwise :
          alert "Incorrect Month Passed.  Use 2 digit months opr standard abreviaions."
          exit
      end case
    end if
    if thisMonth.char.count = 1 then    
      thisMonth = "0" & thisMonth
    else if thisMonth.char.count < 1 or thisMonth.char.count > 2 then
      alert "Incorrect Month typed passed.  Wrong Number of Digits.  Use 2 digit Months."
      exit
    end if
    --the Day
    thisDay = (dateList[x]).item[theDay]
    if integer(thisDay) = void then
      alert "Incorrect Day typed passed.  Value must be a number.  Use 2 digit Days."
      exit
    end if
   -- put thisDay
    if thisDay.char.count = 1 then
      thisDay = "0" & thisDay
    else if thisDay.char.count < 1 or thisDay.char.count > 2 then
      alert "Incorrect Day typed passed. Use 2 digit Days."
      exit
    end if
    dateList[x] = thisYear & thisMonth & thisDay
  end repeat  
-- put dateList[1] && dateList[2] && dateList[3]
  if dateList[2] <= dateList[1] and dateList[3] >= DateList[1] then
    return true
  else
    return false
  end if
end

on getBehaviorDescription me
  return "This script will verify if a date (checkDate) is between 2 other dates.  Call with day/month/year formatting.  Change the theDay, theMont, and theYear variables to use a different order."
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail