Mega Code Archive

 
Categories / Ruby / Time
 

Format time as %m-%d-%Y %H

time = Time.gm(2005, 12, 31, 13, 22, 33) date_and_time = '%m-%d-%Y %H:%M:%S %Z' time.strftime(date_and_time)               # => "12-31-2005 13:22:33 GMT"