ksh epoch to datetime format
<p>I have a script for find the expire date of any user password. Script can find the expire date in seconds (epoch) but cannot convert this to datetime format.</p>

<pre><code>#!/usr/bin/ksh

if (( ${#} &lt; 1 )) ; then
   print "No Arguments"
   exit
fi

lastupdate=`pwdadm -q $1|awk '{print $3;}'`
((lastupdate=$lastupdate+0))
maxagestr=`lsuser -a maxage $1`
maxage=${maxagestr#*=}
let maxageseconds=$maxage*604800
expdateseconds=$(expr "$maxageseconds" + "$lastupdate")
((expdateseconds=$expdateseconds+0))
expdate=`perl -le 'print scalar(localtime($expdateseconds))'`
echo $expdateseconds
echo $expdate
</code></pre>

<p>In this script, expdateseconds value is true. If I type the value of expdateseconds as a parameter of localtime() function, the function show the date in datetime format.</p>

<p>But if I type the $expdateseconds variable, the function does not work true and return 01.01.1970 always. </p>

<p>How can I enter a variable as a parameter of localtime() function?</p>