GuzzyD
GuzzyD

Reputation: 85

How to find time in sh scripting

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

Upvotes: 2

Views: 3066

Answers (2)

Manoj Govindan
Manoj Govindan

Reputation: 74675

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

Upvotes: 3

sje397
sje397

Reputation: 41812

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

Upvotes: 2

Related Questions