Skip to content

Instantly share code, notes, and snippets.

@thelastinuit
Created July 24, 2014 00:09
Show Gist options
  • Save thelastinuit/600d5cc71d86dc0bfadb to your computer and use it in GitHub Desktop.
Save thelastinuit/600d5cc71d86dc0bfadb to your computer and use it in GitHub Desktop.
Date & Time Formatter Rails
# Date
# ----------------------------
#Date::DATE_FORMATS[:default] = "%Y-%m-%d" # 2013-11-03
#Date::DATE_FORMATS[:default] = "&proc" # November 3rd, 2013
#Date::DATE_FORMATS[:default] = "%B %e, %Y" # November 3, 2013
#Date::DATE_FORMATS[:default] = "%e %b %Y" # 3 Nov 2013
#Date::DATE_FORMATS[:default] = "%Y%m%d" # 20131103
#Date::DATE_FORMATS[:default] = "%e %b" # 3 Nov
#Date::DATE_FORMATS[:default] = "" # custom
# DateTime
# ----------------------------
#DateTime::DATE_FORMATS[:default] = "%Y-%m-%d" # 2013-11-03 14:22:18
#DateTime::DATE_FORMATS[:default] = "&proc" # November 3rd, 2013 14:22
#DateTime::DATE_FORMATS[:default] = "%B %e, %Y" # November 3, 2013 14:22
#DateTime::DATE_FORMATS[:default] = "%e %b %Y" # Sun, 3 Nov 2013 14:22:18 -0700
#DateTime::DATE_FORMATS[:default] = "%Y%m%d" # 20131103142218
#DateTime::DATE_FORMATS[:default] = "%e %b" # 3 Nov 14:22
#DateTime::DATE_FORMATS[:default] = "" # custom
# Time
# ----------------------------
#Time::DATE_FORMATS[:default] = "%Y-%m-%d %H:%M:%S" # 2013-11-03 14:22:18
#Time::DATE_FORMATS[:default] = "&proc" # November 3rd, 2013 14:22
#Time::DATE_FORMATS[:default] = "%B %d, %Y %H:%M" # November 3, 2013 14:22
#Time::DATE_FORMATS[:default] = "%a, %d %b %Y %H:%M:%S %z" # Sun, 3 Nov 2013 14:22:18 -0700
#Time::DATE_FORMATS[:default] = "%d %b %H:%M" # 3 Nov 14:22
#Time::DATE_FORMATS[:default] = "%Y%m%d%H%M%S" # 20131103142218
#Time::DATE_FORMATS[:default] = "%H:%M" # 14:22
#Time::DATE_FORMATS[:default] = "" # custom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment