I have a set of date/time strings in the YYYYMMDDHHMMSS format that I want to convert to something readable by the date utility. Usually, I can do something li
What's with all of these regular expression answers? The date(1) tool has the ability to use strftime() style date formatting... an an example of converting one date type to another:
$ date -j -f "%Y%m%d%H%M%S" "20100101123456" "+%Y-%m-%d %H:%M:%S"
2010-01-01 12:34:56
So if it's not in the format you want, convert it like that and then use it. If you just want to set it, you can simply do:
$ date -f "%Y%m%d%H%M%S" "20100101123456"