- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script Help
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
Forums
Discussions
Discussions
Discussions
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
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
02-06-2002 05:52 AM
02-06-2002 05:52 AM
date '+%m\/%d\/%y' and my output looks like
02\/06\/02.
How can I use this same method to get tomorrows date in the form 02/07/02. I dont need the back slash in 'tomorrows date' output.
Thanks,
Bob
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 05:56 AM
02-06-2002 05:56 AM
Re: Script Help
Is that what you are after?
Remove the \/ from your script and see if that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 05:57 AM
02-06-2002 05:57 AM
Re: Script Help
try this
x=`date +%m"/"%d"/"%y`;echo $x
Hope this help
jose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 05:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 06:25 AM
02-06-2002 06:25 AM
Re: Script Help
A. Clay Stephenson has contributed the attached script on a number of occasions. It can be used to convert to and from Julian dates which makes date math simple. To get tomorrow's date in the form mmddyy:
caljd.sh `caljd.sh -n1` | sed 's/ //g' | cut -c1-4,7-8
If you do want / delimited:
caljd.sh `caljd.sh -n1` | sed 's/ /\//g' | cut -c1-6,9-10
All the credit to Clay.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 06:29 AM
02-06-2002 06:29 AM
Re: Script Help
DATE=`date +%m/%d/%y`
GL,
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 06:44 AM
02-06-2002 06:44 AM
Re: Script Help
I have used the trick noted by Andreas, too. However, if you want the date *exactly* 24-hours from your current date; that is, exactly the *next* day, you need to account for the difference you are from UTC.
Thus, in my US Eastern time zone, I am 5 hours earlier than UTC. Thus, if I want tomorrow's date I specify (24 - 5 or 19 hours from now):
# TZ=EST-19 date
Note that this only works for offsets less than 24-hours so these tricks work only for one day offsets.
Note too, the blank after the TZ variable is set. There is no semicolon either! This syntax sets the TZ variable *only* for this command line.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:16 AM
02-06-2002 07:16 AM
Re: Script Help
TZ=EST+5 date
One may want to allow for Daylight Savings Time. In the case of Eastern US you could check the results of "date +%Z". If EDT you could then use:
TZ=EDT-20 date
or for yesterday:
TZ=EDT+4 date
Actually, it didn't matter if I use EST or EDT as long as the numerical offset was adjusted.
I didn't test for dates and times during the time change between EST and EDT (nor vice versa). I wonder what the results would be?
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 08:03 AM
02-06-2002 08:03 AM
Re: Script Help
Our European friends living around the Prime Meridian are the "lucky" ones who can use +-24 hours to exactly compute yesterday or tommorrow including the correct time.
If you look at the man pages for environ (5) you will note that offset is the value that must be added to local time to arrive at UTC (GMT). Offset takes the format hh[:mm[:ss]]
where (hh)is any value from 0 through 23. The optional minutes (mm) and seconds (ss) fields are a value from 0 through 59. The hour field is required. If offset is preceded by a -, the time zone is east of the Prime Meridian. A + preceding offset indicates that the time
one is west of the Prime Meridian.
Notice, for example that while it is now 1100 hours on February 6 in the Eastern US, you cannot produce a date *and time* exactly 24-hours ago. To affect this, the computation would need to offset 29 hours (24+5), an invalid offset.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 08:21 AM
02-06-2002 08:21 AM
Re: Script Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 12:37 PM
02-08-2002 12:37 PM
Re: Script Help
Regarding: TZ=EST+5 date
After seeing another post today, I looked back at this one and noticed Jim's last comment. So I tried it again.
I swear I tested using EST+5 yesterday before posting but now it doesn't work! So, even though I thought it worked then, it definitely does not work now.
I gotta lay off the cafeine (or maybe I need more)! My apologies.
Darrell