I am trying to convert a file date to epoch using a single line of code in Solaris 10, which uses an older version of perl.
I have been able to convert epoch to a date with your assistance:
echo $epoch | perl -MPOSIX -e 'print strftime("%m%d%H%M", gtime <stdin>)'However, I would like to now reverse this process.
I was thinking about something like the following:
echo "Mar 20 2018 09:00" | perl -MPOSIX -e 'print strptime(<stdin>, "%s")'But, I receive an error "Undefined subroutine &main::strptime called at -e line 1, <stdin> line 1. I tried substituting <stdin> with $ARGV[0] but still receive a subroutine error.
In reply to Date to Epoch by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |