[HPADM] RE: Getting the date from the number of seconds since epoch



A little script:

#!/usr/bin/perl
print scalar localtime $ARGV[0];
print "\n"

Just give the epoch (seconds) as input.

OR doing single command line:

perl -e 'print scalar localtime $ARGV[0];print "\n"' <epoch>


-----Original Message-----
From: hpux-admin-owner@xxxxxxxxxxxxx
[mailto:hpux-admin-owner@xxxxxxxxxxxxx] On Behalf Of Schupsky, Mark D
Sent: Thursday, October 12, 2006 10:01 AM
To: hpux-admin@xxxxxxxxxxxxx
Subject: [HPADM] Getting the date from the number of seconds since epoch

Anyone know a correlated command to the perl command given below that
would return the date given the number of seconds since epoch?

Mark

-----Original Message-----
From: hpux-admin-owner@xxxxxxxxxxxxx
[mailto:hpux-admin-owner@xxxxxxxxxxxxx] On Behalf Of Shaw, Marco
Sent: Thursday, October 12, 2006 8:25 AM
To: hpux-admin@xxxxxxxxxxxxx
Subject: [HPADM] SUMMARY: Getting the data in seconds since epoch


Answer from: Bill Thompson

"Here's one way: perl -e 'printf "%d", time();'"



Original query:
---------------
I want a simple command like 'date' to get the seconds since epoch on a
HP-UX (11.23/PA-RISC) server.

Anything exists?

Marco
---------------

--
---> Please post QUESTIONS and SUMMARIES only!! <---
To subscribe/unsubscribe to this list, contact
majordomo@xxxxxxxxxxxxx
Name: hpux-admin@xxxxxxxxxxxxx Owner:
owner-hpux-admin@xxxxxxxxxxxxx

Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse
only)
http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse &
search)


--
---> Please post QUESTIONS and SUMMARIES only!! <---
To subscribe/unsubscribe to this list, contact
majordomo@xxxxxxxxxxxxx
Name: hpux-admin@xxxxxxxxxxxxx Owner:
owner-hpux-admin@xxxxxxxxxxxxx

Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse
only)
http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse &
search)


--
---> Please post QUESTIONS and SUMMARIES only!! <---
To subscribe/unsubscribe to this list, contact majordomo@xxxxxxxxxxxxx
Name: hpux-admin@xxxxxxxxxxxxx Owner: owner-hpux-admin@xxxxxxxxxxxxx

Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only)
http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search)



Relevant Pages

  • [HPADM] Getting the date from the number of seconds since epoch
    ... Anyone know a correlated command to the perl command given below that ... Subject: [HPADM] SUMMARY: Getting the data in seconds since epoch ... To subscribe/unsubscribe to this list, ...
    (HP-UX-Admin)
  • Re: RPM naming question.
    ... Aaron Konstam wrote: ... This is what I get when I run the above command: ... Try breaking the strings up manually (and adding an epoch of 0): ... Tact is just a mutual agreement to be full of shit. ...
    (Fedora)
  • [HPADM] SUMMARY: Getting the date from the number of seconds since epoch
    ... print scalar localtime $ARGV; ... Just give the epoch as input. ... OR doing single command line: ... To subscribe/unsubscribe to this list, ...
    (HP-UX-Admin)
  • Epoch finder
    ... OK - I have an old C program print out the epoch. ... program that converts the epoch to a 'date' command. ... echo "Enter time " ... # things, check with a tweak. ...
    (AIX-L)