Re^2: Getting UNIX time from the shell

Andrew Cunningham andyc at hpopd.HP.COM
Wed Jun 21 18:44:12 AEST 1989


Usinh HP-UX 6.5 on a 9000/360, using
	date '+%H:%M:%S'
prints the date, so use command substitution to get this into the
variable you want us
e:

	time=`date +%H:%M:%S`  (sh)
or
	set time = `date +%H:%M:%S`  (csh)

to get each component:
	hrs=`date +%H`
	min=`date +%M`
	sec=`date +%S`


Hope this helps!
Andrew Cunningham

Disclaimer:  I am NOT speaking as an employee of HP.

Andrew Cunningham, HP Software Engineering Systems Division, Pinewood
E-mail:      andyc at hpopd               hplabs!hpopd!andyc  



More information about the Comp.unix.questions mailing list