- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Date conversion
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2005 09:12 AM
06-23-2005 09:12 AM
Date conversion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2005 09:15 AM
06-23-2005 09:15 AM
Re: Date conversion
http://mirrors.develooper.com/hpux/caljd-2.23.sh
and here if you prefer perl version:
http://mirrors.develooper.com/hpux/caljd-2.2.pl
thanks to A. Clay Stephenson of these forums.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2005 09:23 AM
06-23-2005 09:23 AM
Re: Date conversion
is Perl's time and localtime functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2005 09:29 AM
06-23-2005 09:29 AM
Re: Date conversion
#!/usr/bin/ksh
#
# display # of seconds since 1/1/1970 00:00:00 GMT
#
/usr/bin/date -u '+%y:%j:%H:%M:%S' | IFS=: read YR DAY HR MIN SEC
print $(((YR*365+YR/4+((YR%4)>0)+DAY+10956)*86400+(HR*3600+MIN*60+SEC)))
and in case last line breaks due to length, print and everything after that is on one single line
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2005 09:35 AM
06-23-2005 09:35 AM
Re: Date conversion
typeset -i NOW=$(perl -e 'print time()')
echo "Epoch seconds = ${NOW}"
(( NOW -= 300 )) # subtract 5 minutes
echo "Epoch seconds - 5 minutes = ${NOW}"
typeset DT=$(perl "print scalar localtime(${NOW})")
echo "Date 5 minutes ago = ${DT}"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2005 11:49 AM
06-23-2005 11:49 AM
Re: Date conversion
if i have taken your question right...
try
# date +%s
if this served ur query update me
Regards
Vinod K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2005 11:53 AM
06-23-2005 11:53 AM
Re: Date conversion
added to my previous mail
The following PERL one-liner also prints the seconds since the start of
the epoch:
/opt/perl/bin/perl -e '$epoch = time; print "$epoch\n";'
Regards
Vinod K