I'm trying to convert a date stored in a variable into unix timestamp. I have the value, I must provide the format of this value("%m%d%Y") and then convert it ("%s"). Could you please give me a hint?
>initial_date=02012014
>date_2_unixtime=`date +"%m%d%Y" -d $initial_date +"%s"`
date: extra operand `+%s'
Try `date --help' for more information.
Thank you
Copyright Notice:Content Author:「user3253335」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/21477601/convert-date-stored-variable-into-unix-time-bash