I think watir now includes active support ( and if it doesnt its easy to add it anyway) then you can do things like this:
irb(main):001:0> require 'date' => true irb(main):002:0> require 'activesupport' => true irb(main):003:0> Date.today + 2.days => Wed, 19 Nov 2008 Paul On Mon, Nov 17, 2008 at 8:46 PM, Sunil Philip <[EMAIL PROTECTED]>wrote: > > Thanks for the solution Alan. > > I also got 2 other methods which are given below: > > Method 1: > > require 'date' > > temp = Date::today+1 > puts(temp.strftime("%d-%b-%Y").upcase) > > Method 2: (I got it from this group itself) > > 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(0,0,0) > puts @new_date > puts @new_date.strftime("%d-%b-%Y") > > > > > On Nov 17, 5:50 pm, "Alan Baird" <[EMAIL PROTECTED]> wrote: > > Sunil - > > You want the Time class which is one of Ruby's core classes (seehttp:// > www.ruby-doc.org/core/ <http://www.ruby-doc.org/core/>look for the > > Time class). Here are some examples that may help: > > > > irb(main):014:0> require 'time' > > => true > > irb(main):016:0> t = Time.parse("30-11-2008") > > => Sun Nov 30 00:00:00 -0600 2008 > > irb(main):017:0> t = t + (60 * 60 * 24) > > => Mon Dec 01 00:00:00 -0600 2008 > > irb(main):020:0> t.strftime("%m/%d/%Y") > > => "12/01/2008" > > > > Alan > > > > On Mon, Nov 17, 2008 at 3:11 AM, Sunil Philip <[EMAIL PROTECTED] > >wrote: > > > > > > > > > > > > > Hi All.. > > > > > Need help regarding adding date. In my application, there is a text > > > field which shows the system date. And i need to copy the next date to > > > another text field. What i curently do is, i add a number to the date > > > and then put that in the requried text field. Problem occurs when the > > > date is the last day of that month. Eg: if the system date is 30- > > > NOV-2008, i need to add 1-DEC-2008. How will it be possible? Is there > > > any method to add days to the system date? please help.. > > > > > Sunil- Hide quoted text - > > > > - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---