Skip to content

Instantly share code, notes, and snippets.

@lisasy
Created December 5, 2014 18:38
Show Gist options
  • Save lisasy/fe7d2979bc9204779df8 to your computer and use it in GitHub Desktop.
Save lisasy/fe7d2979bc9204779df8 to your computer and use it in GitHub Desktop.
Ruby date format method
# Outputs date in format: "March 16, 2003"
def format_date(date)
date.strftime("%B %e, %Y")
end
# Use in view file this way:
<%= format_date(article.timestamp) %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment