views:

38

answers:

2

I'm trying to find a way to get date and time separately. For date I can do:

date -u +%d/%m/%Y

What should I do to find the time in the following format?

hh/mm/ss

Thanks

+2  A: 
date -u +%H/%M/%S
sje397
btw is this for current time?
GuzzyD
@GuzzyD - just as current as your date ;) the '-u' argument on both gives "Coordinated Universal Time"
sje397
so wat if i want it to view the current time in also the time zone +8:00 ?
GuzzyD
@GuzzyD: Try `date -u -d "now UTC-8"` or `TZ=UTC-8 date` (I'm not sure why the signs are reversed).
Dennis Williamson
cheers thanks! ;)
GuzzyD
+3  A: 

The date command can give you the time part as well. Check out the man page (or type man date on your command line) for more details.

date -u +%H:%M:%S

Or to meet your formatting requirement of HH/MM/SS:

date -u +%H/%M/%S
Manoj Govindan
thanks for that! ;)
GuzzyD