Created
July 15, 2014 03:06
-
-
Save jdibiccari/db6eaf525f990243400a to your computer and use it in GitHub Desktop.
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
#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