Skip to content

Instantly share code, notes, and snippets.

Created October 6, 2017 02:57
Show Gist options
  • Save anonymous/8c199f0e01f9745c20613ba7d5a9e4c3 to your computer and use it in GitHub Desktop.
Save anonymous/8c199f0e01f9745c20613ba7d5a9e4c3 to your computer and use it in GitHub Desktop.
prog.rb:6: syntax error, unexpected tIDENTIFIER, expecting keyword_then or ';' or '\n'
... dateArray[1] = dateArray[1].last(2)
... ^
prog.rb:7: syntax error, unexpected tIDENTIFIER, expecting keyword_end
... params[:date] = dateArray[0] + "-" ...
... ^
prog.rb:9: syntax error, unexpected keyword_end, expecting end-of-input
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