- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Simple way of obtaining previous day?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2007 01:50 AM
тАО11-21-2007 01:50 AM
Simple way of obtaining previous day?
- Tags:
- date arithmetic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2007 01:54 AM
тАО11-21-2007 01:54 AM
Re: Simple way of obtaining previous day?
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2007 01:57 AM
тАО11-21-2007 01:57 AM
Re: Simple way of obtaining previous day?
# perl -MPOSIX -le 'print strftime "%a",localtime(time-(60*60*24))'
This subtracts one day (in seconds) and gives the previous day. The 'strftime' formatting directives are the same as those you would use with 'date'.
Regards!
...JRF...
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2007 01:58 AM
тАО11-21-2007 01:58 AM
Re: Simple way of obtaining previous day?
for DAY in `date +%a`
do
case $DAY in
Sun) PREVDAY=Sat
;;
Mon) PREVDAY=Sun
;;
Tue) PREVDAY=Mon
;;
Wed) PREVDAY=Tue
;;
Thu) PREVDAY=Wed
;;
Fri) PREVDAY=Thu
;;
Sat) PREVDAY=Fri
;;R=$PRNTR
*) PREVDAY=Oops
;;
Simplistic, but functional.
Pete
Pete
- Tags:
- date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2007 02:01 AM
тАО11-21-2007 02:01 AM
Re: Simple way of obtaining previous day?
Of course, you need to fix the boundary value problem by pointing to some empty file for the first time?
Or you can look for Clay's caljd.pl script:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1126040
And many other threads.
- Tags:
- caljd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2007 02:06 AM
тАО11-21-2007 02:06 AM