Current Minutes

To get minutes from current time in Bash script, use date command with format that returns only the minutes.

Syntax

The syntax to get minutes from current time is

</>
Copy
date +%M

Example

In the following script, we get the minutes from current time in variable minutes, and echo it to the standard console.

Example.sh

</>
Copy
minutes=$(date +%M)
echo "Minutes : $minutes"

Output

Minutes : 33

Conclusion

In this Bash Tutorial, we have learnt how to get minutes from current date in Bash Script using date command.