PingTool.org

Add / substract time in bash

To add or substract any amount of seconds, minutes, hours, days, weeks, months or years to/from current date use the Linux date command:

[code]
date -d ‘+2 hour’
[/code]

If you want to use specific date as a base:

[code]
date -d ‘2010-01-01 + 2 year’
[/code]

Exit mobile version