Created
October 6, 2017 02:57
-
-
Save anonymous/8c199f0e01f9745c20613ba7d5a9e4c3 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
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 |
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
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