Issue
I want to pass 1 hour earlier time in unix timestamp in my request:
curl -X PUT -H "Content-Type: application/json" -d '{"time":UNIX_TIME_STAMP-1 HOUR}' url
How can I generate and pass UNIX_TIME_STAMP-1 HOUR while making a curl request?
This gives me current time - 1 hour, but I am unable to pass it as param:
date -d '1 hour ago' "+%s"
Solution
You can subshell date
curl -X PUT -H "Content-Type: application/json" -d '{"time":'"`date -d '1 hour ago' +%s`"'}' url
Answered By - on8tom