Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Long to Date Format 1

Status
Not open for further replies.

Einstein47

Programmer
Nov 29, 2001
737
US
I am writing a script to report all the users and the last time they logged in. I am using the lsuser command and have the following:

Code:
lsuser -c -a gecos time_last_login | egrep -v "^#" | tr ":" "\011"

The problem is the time is being displayed as a long int. Here is a sample output:

Code:
johnd   John Doe  1018373874

I think I should use the date command, but the syntax excapes me. Any suggestions?
Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
perl -e 'print scalar localtime(1018373874),"\n"'

Incorporating the rest of the logic within perl is left as an exercise to the reader ;)

vlad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top