http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M001695
Miembro desde hace: <%= time_ago_in_words(current_user.created_at.to_date) %>
Tiempo: <%= distance_of_time_in_words(attempt.finishtime, attempt.begintime) %>
now = Time.now
puts now #=> Thu May 18 23:36:10 CDT 2006
puts now.to_date #=> 2006-05-18
puts now.to_s #=> Thu May 18 23:36:10 CDT 2006
puts now.to_s(:short) #=> 18 May 23:36
puts now.to_s(:long) #=> May 18, 2006 23:36
puts now.to_s(:db) #=> 2006-05-18 23:36:10
puts now.to_s(:rfc822) #=> Thu, 18 May 2006 23:36:10 -0500
puts now.ago(3600) #=> Thu May 18 22:36:10 CDT 2006
puts now.at_beginning_of_day #=> Thu May 18 00:00:00 CDT 2006
puts now.at_beginning_of_month #=> Mon May 01 00:00:00 CDT 2006
puts now.at_beginning_of_week #=> Mon May 15 00:00:00 CDT 2006
puts now.at_beginning_of_quarter #=> Sat Apr 01 00:00:00 CST 2006
puts now.at_beginning_of_year #=> Sun Jan 01 00:00:00 CST 2006
puts now.at_midnight #=> Thu May 18 00:00:00 CDT 2006
puts now.change(:hour => 13) #=> Thu May 18 13:00:00 CDT 2006
puts now.last_month #=> Tue Apr 18 23:36:10 CDT 2006
puts now.last_year #=> Wed May 18 23:36:10 CDT 2005
puts now.midnight #=> Thu May 18 00:00:00 CDT 2006
puts now.monday #=> Mon May 15 00:00:00 CDT 2006
puts now.months_ago(2) #=> Sat Mar 18 23:36:10 CST 2006
puts now.months_since(2) #=> Tue Jul 18 23:36:10 CDT 2006
puts now.next_week #=> Mon May 22 00:00:00 CDT 2006
puts now.next_year #=> Fri May 18 23:36:10 CDT 2007
puts now.seconds_since_midnight #=> 84970.423472
puts now.since(7200) #=> Fri May 19 01:36:10 CDT 2006
puts now.tomorrow #=> Fri May 19 23:36:10 CDT 2006
puts now.years_ago(2) #=> Tue May 18 23:36:10 CDT 2004
puts now.years_since(2) #=> Sun May 18 23:36:10 CDT 2008
puts now.yesterday #=> Wed May 17 23:36:10 CDT 2006
puts now.advance(:days => 30) #=> Sat Jun 17 23:36:10 CDT 2006
puts Time.days_in_month(2) #=> 28
puts Time.days_in_month(2, 2000) #=> 29
puts now.xmlschema #=> “2006-05-18T23:36:10-06:00″
date = Date.today
puts date.tomorrow #=> “Fri, 19 May 2006″
puts date.yesterday #=> “Wed, 17 May 2006″
puts date.current #=> “Thu, 18 May 2006″
puts date.to_s #=> “2006-05-18″
puts date.xmlschema #=> “2006-05-18T00:00:00-06:00″
puts date.to_time #=> Thu May 18 00:00:00 CDT 2006
puts date.to_s(:short) #=> “18 May”
puts date.to_s(:long) #=> “May 18, 2006″
puts date.to_s(:db) #=> “2006-05-18″
la funcion en ruby para extraer la extension de un archivo
filename=“archivo.pdf”
File.extname(filename)
regresa “.pdf”
Welcome to AlanMaciel.net.