On Jan 6, 2009, at 10:09 AM, Mmcolli00 Mom wrote:

> How can I add 10 minutes to this time stamp? Thanks. MC
>
> ServerTime = 'Wed Dec 09 16:05:00 -0600 2009'

First of all, Ruby treats names beginning with an uppercase letter as  
Constants. If you really want a variable, use server_time.

> ServerTime + Time.parse(10)
>
> #<-it does not work without parse since I get error can't convert  
> Fixnum
> into a string. what do you think?
> -- 


irb> require 'time'
=> true
irb> server_time_as_string = 'Wed Dec 09 16:05:00 -0600 2009'
=> "Wed Dec 09 16:05:00 -0600 2009"
irb> server_time_as_time = Time.parse(server_time_as_string)
=> Wed Dec 09 17:05:00 -0500 2009

Note that this is just *my* timezone for the output.

irb> server_time_as_time + 10*60
=> Wed Dec 09 17:15:00 -0500 2009

Time + Fixnum adds seconds so 10 minutes is 10*60 seconds.

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob / AgileConsultingLLC.com