From: Detlef Reichl Date: 2006-01-17T05:42:52+09:00 Subject: Re: [newbie] this month, the next month, and the one after that Am Dienstag, den 17.01.2006, 04:45 +0900 schrieb Mason Kessinger: > What I want to do is simple. > > I'd like code that prints out the name of this month (January) the next > month (February) and the one after that (March) > > I've been able to print this month: > > <% t = Time.now %> > <%= t.strftime(" This Month is: %B") %> > > But I can't figure out how to get the next months to print out! > Try this: irb(main):040:0* t = Time.now => Mon Jan 16 21:27:58 CET 2006 irb(main):041:0> m = t.mon => 1 irb(main):042:0> nt = Time.mktime 2006, m + 1 => Wed Feb 01 00:00:00 CET 2006 irb(main):043:0> p nt.strftime("%B") "February" => nil irb(main):044:0> nt = Time.mktime 2006, m + 2 => Wed Mar 01 00:00:00 CET 2006 irb(main):045:0> p nt.strftime("%B") "March" => nil Cheers detlef