Ruby

The command which -a ruby will show you where Ruby is installed.

which -a ruby

Time

# current time
Time.now # 2009-06-24 12:39:54 +0900

# Return Time string with certain format - dd-Mon-yyyy HH:MM am/pm
"%d-%b-%Y %-l:%M%P" # 27-Jan-2016 7:19am
"%d/%m/%Y %-l:%M%P" # 27/01/2016 7:19am

More about Time API - Link

Changing the format of Date & Time

<%= Time.now.strftime("%m/%d/%Y") %>
<%= DateTime.now.strftime("%m/%d/%Y") %>

<%= DateTime.now.strftime("%e-%b-%Y %m:%M %p %Z") %>
# outputs - 12-Feb-2016 07:05 PM IST

In case if you want custom format use Strftime

Last updated