Incase anyone needs to add or subtract days, months, years or all of
the above from a known date the following works for me.
require 'date'
#Date Add Function
def date_add(mth,day,yr)
#Set Date Variable
@new_date = Date.today
#Month calculations
if mth != 0
@new_date = @new_date >> mth
end
#Day calculation
if day != 0
@new_date = @new_date.+(day)
end
#Year calculation
if yr != 0
@new_date = @new_date >> yr * 12
end
#Returns new date
return @new_date
end
@new_date = date_add(2,3,4)
puts @new_date.strftime("%m/%d/%Y")
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines:
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---