Ruby Time Conversion
#!/usr/bin/env ruby
puts 'Enter your date of birth in the form yyyy/mm/dd'
birth = gets.chomp
puts "you entered #{birth}"
puts 'Enter your time of birth in the form 00:00:00'
time = gets.chomp
puts "you entered #{time}"
year = birth[0..3]
month = birth[5..6]
day = birth[8..9]
hour = time[0..1]
minute = time[3..4]
second = time[6..7]
t = Time.new(year.to_i, month.to_i, day.to_i, hour.to_i, minute.to_i, second.to_i, "-07:00")
c = Time.now
a = c.to_i - t.to_i
puts "You have been alive for #{a} seconds!"
Output
josh@HAL:~/Code/RubyWebsite/Time-Conversion$ ./conversion.rb
Enter your date of birth in the form yyyy/mm/dd
2001/09/17
you entered 2001/09/17
Enter your time of birth in the form 00:00:00
1:30:57
you entered 1:30:57
You have been alive for 700526094 seconds!