Skip to content

Instantly share code, notes, and snippets.

@vargheseraphy
Created March 13, 2015 05:51
Show Gist options
  • Save vargheseraphy/a7c0ce33b6cb9523b1d4 to your computer and use it in GitHub Desktop.
Save vargheseraphy/a7c0ce33b6cb9523b1d4 to your computer and use it in GitHub Desktop.
Change the date format in ruby using Date.parse
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