- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- date 5 days from now formatted at %Y-%m-%d
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
тАО10-08-2003 04:14 AM
тАО10-08-2003 04:14 AM
2003-10-08
i.e. %Y-%m-%d
i've used the commands
date -d "5 days next"
but it returns
Mon Oct 13 01:00:00 UTC 2003
anyone have a quick one liner (preferably without the use of caljd.sh)?
Any answer will be appreciated
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2003 04:19 AM
тАО10-08-2003 04:19 AM
Re: date 5 days from now formatted at %Y-%m-%d
That's interesting - I'm unfamiliar with the -d option. I get:
$ date -d "5 days next"
date: illegal option -- d
Usage: date [-u] [+format]
date [-u] [mmddhhmm[[cc]yy]]
date [-a [-]sss.fff]
So I'm not sure how you're going to do this without caljd.sh.
;^(
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2003 04:28 AM
тАО10-08-2003 04:28 AM
Re: date 5 days from now formatted at %Y-%m-%d
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2003 04:29 AM
тАО10-08-2003 04:29 AM
Re: date 5 days from now formatted at %Y-%m-%d
I think you'd have a chance if you use the %j (day of the year) & increment by 5 & convert that back to a standard date. Something like...
var1=$(date +%j + 5)
but that syntax isn't right.
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2003 04:31 AM
тАО10-08-2003 04:31 AM
SolutionDT=$(perl -e '($y,$m,$d) = (localtime(time() + (5 * 86400))) [5,4,3]; printf("%04d-%02d-%02d",$y + 1900,$m + 1,$d);'
echo "Date = ${DT}"
I find that
DT=$(caljd.sh -y -S "-" $(caljd.sh -n 5))
echo "Date = ${DT}"
to be much simpler.
You can also download and install the Gnu version of date which will do just about what your original date requests although over a much more limited range than caljd.sh will addrsss.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2003 04:35 AM
тАО10-08-2003 04:35 AM
Re: date 5 days from now formatted at %Y-%m-%d
DT=$(perl -e '($y,$m,$d) = (localtime(time() + (5 * 86400))) [5,4,3]; printf("%04d-%02d-%02d",$y + 1900,$m + 1,$d);')
echo "Date = ${DT}"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2003 04:47 AM
тАО10-08-2003 04:47 AM