soField
soField

Reputation: 2696

hp-ux how to get 2 hours ago bash datetime

we are using hp-ux servers we need to get 2 hours ago datetime value in bash shell script ?

how can i do that any experiences ?

Upvotes: 4

Views: 8601

Answers (2)

user unknown
user unknown

Reputation: 36259

date -d -2hours; date --version

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

Upvotes: 7

JYelton
JYelton

Reputation: 36526

I'm not a shell script expert, but you may want to check this site at unix.com. They provide this example for subtracting 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"

Upvotes: 1

Related Questions