- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Date question addendum
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
06-14-2002 01:41 PM
06-14-2002 01:41 PM
This is an addendum to my earlier date question. I've used A. Clay Stephenson's "date hammer" to fix part of my script. Now I have another question. Because we have offices located in several timezones, we need to get a date one week from the current date in GMT. We don't want to have to change the timezone on the server just to make this work. Based upon Clay's earlier answer, I have gotten this far:
CURRDATE_7=$(caljd.sh -e -S "-" $(caljd.sh -n 7))
The problem is that this is PDT and we need it to work in GMT.
Thanks in advance for your help,
Kris
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2002 01:49 PM
06-14-2002 01:49 PM
SolutionThis is pretty easy. Remember that all UNIX boxes in the known universe keep time by simply
counting the number of seconds since the Earth was created - Jan. 1, 1970 UTC. The TZ setting only determines how the time is DISPLAYED in a given process's environment. You can simply do
an "export TZ=GMT0" before the call to caljd.sh
BUT it's even easier to do than that.
Simply change:
CURRDATE_7=$(caljd.sh -e -S "-" $(caljd.sh -n 7))
to:
CURRDATE_7=$(caljd.sh -e -S "-" $(caljd.sh -U -n 7))
The -U does exactly what you want.
P.S. You should have done a caljd.sh -u and read the usage message carefully. It would have told you this.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2002 01:55 PM
06-14-2002 01:55 PM
Re: Date question addendum
perl -e 'print scalar gmtime(time()+7*24*60*60)),"\n"'
will print the date 7 days in the future relative to GMT.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 10:07 AM
06-17-2002 10:07 AM
Re: Date question addendum
Thanks again,
Kris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2002 10:22 AM
06-17-2002 10:22 AM
Re: Date question addendum
I'm glad you liked the script. I really can't take credit for the calendar date to Julian Day
and the Julian Day to calendar date algorithms. Julian Days have been around a very long time and if you ever took an astrophysics course or an advanced mechanics course, you would have been introduced to them.
The algorithms I used are based on some that were published many years ago in 'Sky and Telescope' magazine. (If you are any kind of sky buff, you have a subscription.)
I just added some command-line parsing and holidays stuff to the existing algorithms.
Regards, Clay