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]
cGFyYW1zID0ge30KcGFyYW1zWzpkYXRlXSA9ICIyMDE3LTAxMC0yOSIKCmRlZiBnZXRfY29ycmVjdF9kYXRlCiAgaWYgcGFyYW1zICE9IG5pbCAmJiBwYXJhbXNbOmRhdGVdICE9IG5pbAogICAgZGF0ZUFycmF5ID0gcGFyYW1zWzpkYXRlXS5zcGxpdCgiLSIpCiAgICBpZiBkYXRlQXJyYXlbMV0ubGVuZ3RoID4gMgogICAgICBkYXRlQXJyYXlbMV0gPSBkYXRlQXJyYXlbMV0ubGFzdCgyKQogICAgZW5kCiAgICBwYXJhbXNbOmRhdGVdID0gZGF0ZUFycmF5WzBdICsgIi0iICsgZGF0ZUFycmF5WzFdICsgIi0iICsgZGF0ZUFycmF5WzJdCiAgZW5kCmVuZAogIApnZXRfY29ycmVjdF9kYXRlCgpwcmludCBwYXJhbXNbOmRhdGVdCg==