HP-UX Technical Documentation
Showing results for 
Search instead for 
Do you mean 

date format option

SOLVED
Go to Solution
Regular Advisor

date format option

I read online documentation for the date command http://docs.hp.com/en/B2355-90689/date.1.html.
According to it there is no format option +%s. However when I run this command:
/usr/bin/date +%s
I get a correct result:
1281507492

Why do you not include this format option in your documentation?

1 ACCEPTED SOLUTIONS
Highlighted
Acclaimed Contributor Acclaimed Contributor

Re: date format option

This was implemented on 11.23 in strftime(3) with QXCR1000509179 for Linux compatibility.

I filed an enhancement QXCR1001066009 to document this for strftime(3) and date(1).
9 REPLIES
Honored Contributor Honored Contributor

Re: date format option

hi,

yes you have right, there is no this entry in the manapage, but if you look into general man page ( Unix ) you will find this :

%s seconds since 1970-01-01 00:00:00 UTC

mikap
Honored Contributor Honored Contributor

Re: date format option

By using the "Complete book in PDF" link and check the copyright and publication information in the first pages of the book/PDF.

The document you were reading is the first edition of HP-UX 11.11 man pages, published in December 2000. It's almost 10 years old.

I'm pretty sure this functionality didn't exist in 11.11 in about 2002/2003. I guess it may have been added by some patch after that. At that time, I wrote a tiny C program to overcome the problem.

Which version of HP-UX you're using? ("uname -a" please)

If the option exists but the installed manpage for date(1) on your system doesn't know about it, then it can be said it's a documentation bug.

MK
MK
Regular Advisor

Re: date format option

I am using HP 11.31.

I have taken a look at "HP-UX Reference" (2007) and the manpage on the server. Seems like +%s is not documented.
Honored Contributor Honored Contributor

Re: date format option

Correct, the +%s option is not there in the man page: I checked ( page 205 )of the blackwater,
command referene, it is good that you found it, HP may include it in the next KB Knowledge base document,

http://docs.hp.com/en/B2355-91017/B2355-91017.pdf ## Page 205 (11.31)

---
date(1) date(1)
NAME
date - display or set the date and time
------

Cheers ,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Acclaimed Contributor Acclaimed Contributor

Re: date format option

It appears that %s also works on 11.23.
Honored Contributor Honored Contributor

Re: date format option

Based on some average 11.00, 11.11, 11.23 and 11.31 systems, date %s works starting with 11.23 and fails in anything prior. Yet another item that fell through the documentation gap. It was probably added as a simple change to the date command along with other enhancements and the author forgot to write up the details.
Acclaimed Contributor Acclaimed Contributor

Re: date format option

Hi:

> Bill: Based on some average 11.00, 11.11, 11.23 and 11.31 systems, date %s works starting with 11.23 and fails in anything prior.

And in that case, since all of the aforementioned releases had Perl, simply do:

# perl -le 'print time()'

Regards!

...JRF...
Regular Advisor

Re: date format option

It is a insignificant bug in the technical documentation.
Highlighted
Acclaimed Contributor Acclaimed Contributor

Re: date format option

This was implemented on 11.23 in strftime(3) with QXCR1000509179 for Linux compatibility.

I filed an enhancement QXCR1001066009 to document this for strftime(3) and date(1).