There is a variable var_date
which stores time in format +%Y%m%d%H%M%S
, my requirement is to convert this into second since epoch.
One way to achieve this is to use date command with -d
option like
date -d "$var_date" %s
but this does not work as -d
option expect content of var_date
to be in format %Y-%m-%d %H:%M:%S
and not %Y%m%d%H%M%S
.
Is there any option using which i can convert time stored as %Y%m%d%H%M%S
into second since epoch?