Add some specific time while using the linux command “date”

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)