- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- finding a date value of 15 days before
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
тАО05-26-2011 12:33 AM
тАО05-26-2011 12:33 AM
finding a date value of 15 days before
Lets say a date - May 05, i would like to find out the date of 15 days before this date.
Please suggest....thanks...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-26-2011 01:43 AM
тАО05-26-2011 01:43 AM
Re: finding a date value of 15 days before
Generally, the algorithm would be: convert the date to a Unix timestamp, subtract 15 days (15 * 24 * 60 * 60 seconds) from the timestamp value, then convert the timestamp back to a human-readable date.
If you're using some scripting/programming language (Java, C, Perl, etc.) that can use the standard POSIX ctime(3) and mktime(3) functions, or has other similar functions as standard, this would be easy to implement; with HP-UX standard POSIX shell scripting, not so easy.
Attached is the caljd.sh script by ITRC forums veteran A. Clay Stephenson; use "chmod a+rx caljd.sh" to make it executable, then run "./caljd.sh --help" to get complete instructions for its use.
Example: (the date of 2011-05-05 minus 15 days)
./caljd.sh -y $(./caljd.sh -p 15 -y 2011 05 05)
2011 04 20
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-26-2011 02:00 AM - last edited on тАО07-07-2011 08:24 AM by Kevin_Paul
тАО05-26-2011 02:00 AM - last edited on тАО07-07-2011 08:24 AM by Kevin_Paul
Re: finding a date value of 15 days before
Plenty of other options here:
http://h30499.www3.hp.com/t5/Languages-and-Scripting/How-to-get-a-date-after-a-specific-number-of-days/m-p/4754015#M29751
HTH
Duncan
I am an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-26-2011 02:03 AM
тАО05-26-2011 02:03 AM
Re: finding a date value of 15 days before
i have searched actually,..i remember a post(how to get yesterday's date thru scripting), i searched, but no luck, so i created this post...ok, i will check both....thanks again...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-26-2011 02:30 AM
тАО05-26-2011 02:30 AM
Re: finding a date value of 15 days before
ctime(3) would have that issue, unless you picked a time like 1200.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-26-2011 05:28 AM
тАО05-26-2011 05:28 AM
Re: finding a date value of 15 days before
May 01
got it...thanks GURU's...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-26-2011 05:33 AM
тАО05-26-2011 05:33 AM
Re: finding a date value of 15 days before
Your original query suggests that you want to find the date that was 15-days before some arbitrary date; not necessarily 15-days before today.
For that, see my offering in the link Duncan cited.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-26-2011 01:41 PM
тАО05-26-2011 01:41 PM
Re: finding a date value of 15 days before
perl -MDate::Manip -e 'print DateCalc("today", "+ 4 days"). "\n"'