Clarification on '1 days ago' in date command [Found answer, posted within]
I know the topic of getting yesterday's date has been covered ad nauseum, but I just want to be clear on something.
I recently started using the command
to get yesterday's date and it's been working great. I just want to be certain that it is going to account for the 1st day of the month and jump back to the last day of last month.
Prior to this I'd been using a 12 step case command to check if the date was the 1st day of the month or not, and it would be great if I could just use this one line instead.
Thanks.
---------- Post updated at 04:19 AM ---------- Previous update was at 03:39 AM ----------
Never mind. I set the clock back to the first on my laptop and tested it (and it worked)
Maybe silly question... but since you are looking for the first day of the month, why not use the cron scheduler with a job that executes only on first day of the month to jump back to last day of previous month?
current date command runs well
awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
subtract 30 days fails
awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Hi all,
I have been researching to obtain SSL certification expiry for most of our webistes. For some cases, some hosts where not directly accessible so i finally got a solution working with curl using my proxy. This lists the expiry date which i'm finally looking for.
# curl --proxy... (4 Replies)
Hi
I have shell script and I am facing the below issue to integrate the date calculation to the the script.
If I give the $1 as the date(20110701) then I need to get the 7 days ago date for the same format.(20110624).
At first I thought its a simple one to handle and I did a search in the... (10 Replies)
Hi,
the following gives today
$(date '+%d%m%y')
For example 210111 for today (21 of january 2011).
How can I have n days ego ? For example 160111 for 5 days ego ?
thank you. (3 Replies)
Hello,
I like to begin with :wall:.. literally... It has been 4 days and I have no idea how to fix it.
Environment - AIX 5.3
I wrote a script to call on ssh to log into another box via PKA to do something else.
If I run the script on the terminal, it works 100%. If the SAP customised... (11 Replies)
How could I using the following example, change it to show 2 days ago within the same time frame 0600 AM to 0600 AM
let foo=`date "+(1%H-106)*60+1%M-100"` bar=foo+1440
find . -mmin +$foo -mmin -$bar | tr -s '/','-' '^' | cut -f2,3 -d"^" | tr -s '^' ' ' |
Please use code tags (7 Replies)
Hi,
Anybody knows how to get what date was 28 days ago of the current system date through UNIX script.
Ex : - If today is 28th Mar 2010 then I have to delete the files which arrived on 1st Mar 2010, (15 Replies)