Skip to content

Instantly share code, notes, and snippets.

@jdibiccari
Created July 15, 2014 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdibiccari/db6eaf525f990243400a to your computer and use it in GitHub Desktop.
Save jdibiccari/db6eaf525f990243400a to your computer and use it in GitHub Desktop.
#You can use strftime to format expiration date in variety of acceptable ways
def js_date
self.expiration.strftime("%c")
end
#=>"Tue Jul 15 14:17:22 2014"
def js_date
self.expiration.strftime("%D %T")
end
#=> "07/15/14 14:17:22"
#Or convert to an integer rep. of full date and multiply by 1000
def js_date
self.expiration.to_i * 1000
end
#=>1405448242000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment