From: Matt Mongeau Date: 2013-03-07T05:59:23+09:00 Subject: Re: Compare Zulu time --047d7b343b1c31210b04d747dd8f Content-Type: text/plain; charset=ISO-8859-1 Sorry I should have typed Time.parse("20130505172938Z") not Date.parse("20130505172938Z") On Wed, Mar 6, 2013 at 3:49 PM, robert lengu wrote: > Matt Mongeau wrote in post #1100427: > > probably easier to do the opposite and convert the current time to Zulu > > time. > > > Hi Thanks > i am doing this > > #!/usr/bin/ruby > require 'rubygems' > require 'time' > expire_date = Date.parse("20130505172938Z") > current_time = Time.now.utc > > #puts expire_date > #puts current_time > > def days_away(from, to) > ((to - from) / (60 * 60 * 24)).ceil > end > > if days_away(current_time, expire_date) == 3 > puts "test" > end > > > but it giving me > > /usr/lib/ruby/1.8/date.rb:1220:in `-': expected numeric or date > (TypeError) > from test.rb:11:in `days_away' > from test.rb:14 > > > i tryed with .to_datetime but no luck > what is i am missing??? > > -- > Posted via http://www.ruby-forum.com/. > > --047d7b343b1c31210b04d747dd8f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Sorry I should have typed

Time.parse(&q= uot;20130505172938Z")

not=A0
<= div style>
Date.parse("20130505172938Z")


On Wed,= Mar 6, 2013 at 3:49 PM, robert lengu <lists@ruby-forum.com> wrote:
Matt Mongeau wrote in post #1100427:
> probably easier to do the opposite and convert the c= urrent time to Zulu
> time.
>
Hi Thanks
i am doing this

#!/usr/bin/ruby
require 'rubygems'
require 'time'
expire_date =3D Date.parse("20130505172938Z") current_time =3D Time.now.utc

#puts expire_date
#puts current_time

def days_away(from, to)
=A0 ((to - from) / (60 * 60 * 24)).ceil
end

if days_away(current_time, expire_date) =3D=3D 3
=A0 puts "test"
end


but it giving me

/usr/lib/ruby/1.8/date.rb:1220:in `-': expected numeric or date
(TypeError)
=A0 from test.rb:11:in `days_away'
=A0 from test.rb:14


i tryed with .to_datetime but no luck
what is i am missing???

--047d7b343b1c31210b04d747dd8f--