calendar events

  • Thread starter Michael Linfield
  • Start date
M

Michael Linfield

i want a simply get the amount of days inbetween a range of dates. IE:
1/25 - 2/3 is 8 days difference.

My initial approach the the problem was to create a huge variable setup:

jan = 31 #31 = days in january
feb = 28
mar = 31
apr = 30

im sure thers a better and cleaner way, any ideas on how to approach
this?

Thanks
 
M

Michael Linfield

If you subtract a date object from a date object, the result is "how
many
days later the current date is than x."

HTH,

Felix

Perfect. Thanks a ton!
 
M

Michael Linfield

just another quick question...if i wanted to put a string into a date
format such as the following:


res = []
array = ["2/14/2005",83,35,23]
res << array.grep(/2/\14/\2005/)

# so now res has "2/14/2005" in it...how would i turn that into a --

specdate = Date.new(2, 24, 2005)

so i need 2/14/2005 turned into a date object, preferably not having to
use the format of Date.new(year,day,month) ...id prefer to have it in
the format of month,day,year if possible :)

much thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,264
Messages
2,571,322
Members
48,005
Latest member
ChasityFan

Latest Threads

Top