Epoch2Date

=Convert Epoch number of days to readable= Ok, first here is one script that gives you both ways : USER=$1 CURRENT_EPOCH=`grep $USER /etc/shadow | cut -d: -f3`
 * 1) !/bin/sh

CHANGED=`perl -e "print scalar localtime($CURRENT_EPOCH * 24 *3600);"` MDY=`perl -e "use POSIX qw(strftime); print scalar strftime('%m/%d/%y', localtime($CURRENT_EPOCH * 24 *3600));"`
 * 1) Print  when PW last changed

echo "$USER - password Last changed $CHANGED ($MDY) ." echo
 * 1) echo "$USER's password on $HOST expires in $EXPIRE days"

So, assuming $CURRENT_EPOCH is 14216 (i.e. from /etc/shadow) : perl -e "print scalar localtime($CURRENT_EPOCH * 24 *3600);" results in an output like : Tue Dec 2 18:00:00 2008 So to format it into MM/DD/YY format, do : perl -e "use POSIX qw(strftime); print scalar strftime('%m/%d/%y', localtime($CURRENT_EPOCH * 24 *3600)); the output will be : 12/02/08

Use %Y instead of %y if you want full year displayed [2008 instead of 08].