Skip to content

Instantly share code, notes, and snippets.

Created October 6, 2017 02:29
Show Gist options
  • Save anonymous/8d7670dba208ffa22041e0275ca62139 to your computer and use it in GitHub Desktop.
Save anonymous/8d7670dba208ffa22041e0275ca62139 to your computer and use it in GitHub Desktop.
syntax error
params = {}
params[:date] = "2017-010-29"
def get_correct_date
if params != nil && params[:date] != nil
dateArray = params[:date].split("-")
if dateArray[1].length > 2 dateArray[1] = dateArray[1].last(2)
end params[:date] = dateArray[0] + "-" + dateArray[1] + "-" + dateArray[2]
end
end
get_correct_date
print params[:date]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment