Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

calculadordeidade

require 'time'

Date_of_birth = '1999-12-15'

def humanize secs
  [ 
    [60, :seconds], 
    [60, :minutes], 
    [24, :hours], 
    [365, :days], 
    [100, :years]
  ].map do |count, name|
    if secs > 0
      secs, n = secs.divmod(count)
      "#{n.to_i} #{name}"
    end
  end.compact.reverse.join(' ')
end

loop do
    distance = Time.new - Time.parse(Date_of_birth)
    print humanize(distance)+"\r"
    sleep 1
end

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.