'date' question (wanna find yestreday date)
Not sure if I badly need sleep or what, but I can't remember how I used to do this back when.
From a bash script I want to determine yesterday's date. I don't want a cludge of if statements to account for months with 30 days vs 31, leap year, and etc....
With C or Perl I would normally take the number of seconds since epoch and subtract 86400, then supply this integer as an argument to localtime (or whatever) and it then glean the corresponding date string. (per whatever your desired formatting is) I cannot seem to find a utility that will allow me to provide the number of seconds and received a date string in return. I know I have done this numerous times in the past but my scripting skills have grown rusty... I was almost positive /bin/date would do this in the past but currently trying the version shipped with SLES 9 and don't see any options that can help me. Once again, I need to do this in bash, not perl or C. Thx, cc
On Tuesday 08 February 2005 15:55, Rhugga wrote:
Not sure if I badly need sleep or what, but I can't remember how I used to do this back when.
From a bash script I want to determine yesterday's date. I don't want a cludge of if statements to
date -d yesterday add a + string if you need it in a different format than the default
--- Anders Johansson
On Tuesday 08 February 2005 15:55, Rhugga wrote:
Not sure if I badly need sleep or what, but I can't remember how I used to do this back when.
From a bash script I want to determine yesterday's date. I don't want a cludge of if statements to
date -d yesterday
add a + string if you need it in a different format than the default
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
Thanks, I knew it was some idiot proof way of doing this, heh. The woes of juggling between solaris, linux, and irix all in the same hour. thx,
participants (2)
-
Anders Johansson
-
Rhugga