I dont understand why this command gives an error:
date -j -f "%Y%m%d%H%M%S" "20091101201023" "+%s"
Failed conversion of ``20091101201023'' using format ``%Y%m%d%H%M%S''
date: illegal time format
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
But this i ok:
date -j -f "%Y %m %d %H %M %S" "2009 11 01 20 10 23" "+%s"
1257106223
The commands in Mac Os X are a bit different than in Linux that im am used to. Makes it somewhat difficult to script in the shell.
20091101201023 is the format of the date that i get from a file and i want to convert it in a script to seconds since epoc among other things.
Is it possible with the date command? Or is there some replacement for the date command in the terminal?
date -j -f "%Y%m%d%H%M%S" "20091101201023" "+%s"
Failed conversion of ``20091101201023'' using format ``%Y%m%d%H%M%S''
date: illegal time format
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
But this i ok:
date -j -f "%Y %m %d %H %M %S" "2009 11 01 20 10 23" "+%s"
1257106223
The commands in Mac Os X are a bit different than in Linux that im am used to. Makes it somewhat difficult to script in the shell.
20091101201023 is the format of the date that i get from a file and i want to convert it in a script to seconds since epoc among other things.
Is it possible with the date command? Or is there some replacement for the date command in the terminal?