Created
August 18, 2014 18:36
-
-
Save adagio/28f500ccfaf43f3e9dd5 to your computer and use it in GitHub Desktop.
Current date and time on RoR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="thisinstant"> | |
<div class="date">Date: <%= @strdate %></div> | |
<div class="time">Time: <%= @strtime %><div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WelcomeController < ApplicationController | |
def index | |
d = Time.now | |
@strdate = d.strftime('%b %d') | |
@strtime = d.strftime('%H:%M') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment