Hi experts,
I am a learner of Watir , my scenario is to collect the date value
from a text_field then add one day or subtract one day from that day.
Details are given below.
i get the date from text_field as a string in dd-mmm-yyyy format(02-
MAR-2009).
Then i have to do add or subtract days with the string, then i have to
validate the new date.
below code am using to get the output. But am sure this may not be a
standard coding.
def date_validation( source, count, operation)
start_date = source
date = Date.strptime(start_date, '%d-%b-%Y')
if operation == "a" or operation=="A"
final_date = date + count
end
if operation == "d" or operation=="D"
final_date = date - count
end
final_date = "#{final_date.day}-#{final_date.month}-#
{final_date.year}"
return final_date
end
date_validation(offer_approval_date, 1, "A")
The above code returns the value as dd-mm-yyyy format, but i need the
output as
dd-mmm-yyyy format(03-MAR-2009).
So please modify my code if required and give me a nice solution.
Thanks,
Prince3105
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---