I need to convert to date in bash a string which has the hour included, such as: 2012-02-09-18, and store the result inside a variable, so that I can compare such strings as dates. If I use for conversion
date -d "2012-02-09-18"
it will crash with "Invalid date error". How can I do this?