Issue
In linux, date
can help me to print the current time. If want to print the current time + 1 hour, what option should I give?
Solution
On Linux
Just use -d
(or --date
) to do some math with the dates:
date -d '+1 hour' '+%F %T'
# ^^^^^^^^^^^^
For example:
$ date '+%F %T'
2013-04-22 10:57:24
$ date -d '+1 hour' '+%F %T'
2013-04-22 11:57:24
# ^
On Mac OS
Warning, the above only works on Linux, not on Mac OS.
On Mac OS, the equivalent command is
date -v+1H
Answered By - fedorqui Answer Checked By - Clifford M. (WPSolving Volunteer)