and how would it be if i would like the work with a variable and set the date of the variable 7 days back?
mynewdate=(date -j -f "%d %b %Y %T" "mydatevariable 7 days ago" +"%F %H:%M:%S")

see also:https://www.daniweb.com/software-development/shell-scripting/threads/50041/how-to-format-this-date-under-freebsd

GNU date allows you to do clock relative input delta, but to get the output onto the command line, use "`cmd`" or "$(cmd)". The latter tolerates nesting, is good for ksh & bash. The former is legal in sh, too. You need a + at the front of any format. The delta goes in on its own argument. To be more precise, I would have to look at the date man page, so why don't you?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.