Created
March 13, 2015 05:51
-
-
Save vargheseraphy/a7c0ce33b6cb9523b1d4 to your computer and use it in GitHub Desktop.
Change the date format in ruby using Date.parse
This file contains hidden or 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
require 'date' | |
Date.parse("November 17, 2014").strftime('%Y-%m-%d') | |
#=>"2014-11-17" | |
Date.parse("November 17, 2014").strftime('%y/%m/%d') | |
#=>"14/11/17" | |
# change the '-', '/' or use any separators |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment