How to display time only?

0167

To display only the current time using the date command in Bash, you can use the following command:

date +"%H:%M:%S"

This will output the time in the format HH:MM:SS, for example:

14:30:00

Here’s a breakdown of the format specifiers:

  • %H: Hour (00 to 23)
  • %M: Minute (00 to 59)
  • %S: Second (00 to 59)

Feel free to ask if you have more questions or need additional examples!

0 Comments

no data
Be the first to share your comment!