Hp-ux How to get 2 hours ago bash datetime

we use hp-ux servers do we need to get the datetime value in the bash shell script 2 hours ago?

How can i do this?

+3
source share
2 answers
date -d -2hours; date --version

Thursday 14 02:38:08 CEST 2011
date (GNU coreutils) 7.4

+4
source

I am not an expert shell script, but you can check this site on unix.com . They give this example to subtract from dates:

   # subtract from any date
    date --date "$dte 3 days 5 hours 10 sec ago"
    date --date "$dte -3 days -5 hours -10 sec"
+1
source

Source: https://habr.com/ru/post/1745176/


All Articles