Hi, Prince, please try the code below:
require 'watir'
def date_validation( source, count, operation)
start_date = source
date = Date.strptime(start_date, '%d-%b-%Y')
if operation == "a" or operation=="A"
date += count
elsif operation == "d" or operation=="D"
date-= count
end
time=Time.mktime(date.year, date.month, date.day)
return time.strftime("%d-%b-%Y")
end
date1="03-mar-2009"
puts date_validation(date1, 10, "A")
Output is:
13-Mar-2009
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---