- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Fast Julian Date Conversions
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
10-07-2002 01:15 PM
10-07-2002 01:15 PM
I have used Clay's caljd.sh to do 30, 60, and 90 day date calculations but it is slow when I have to process thousands of these in one report. Does anyone (Clay maybe) have a faster set of routines which can be part of a shell script? I don't need anything really fancy just some basic 30 days from today in MM/DD/YYYY form.
TIA, Mary Rice
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2002 01:23 PM
10-07-2002 01:23 PM
SolutionI'll be the first to admit that caljd.sh is something of a dog these days; it's become feature-rich and as a consequence expanded from less than 40 lines to nearly 1100 lines - most of it is usage, examples, and command-line processing. The good news is that I have 3 functions that are very fast and can be put in any Korn or POSIX shell script and uses the shell's internal arithmatic operators.
The first function is CAL_JDATE, feed it month, day, and year and it echoes a Julian Day.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2002 01:24 PM
10-07-2002 01:24 PM
Re: Fast Julian Date Conversions
Clay has a Perl version of his script. You might give it a try. Here is a link to the most recent thread where Clay posted it:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xab076049dbb6d611abdb0090277a778c,00.html
JP
P.S. Expert? Do you know the definition of an expert?
X-spurt:
X = an unknown quantity
spurt = a drip under pressure
:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2002 01:25 PM
10-07-2002 01:25 PM
Re: Fast Julian Date Conversions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2002 01:27 PM
10-07-2002 01:27 PM
Re: Fast Julian Date Conversions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2002 01:32 PM
10-07-2002 01:32 PM
Re: Fast Julian Date Conversions
Here is a simple example which takes today's date and converts it to a Julian Date and then does the reverse.
JD=$(CAL_JDATE $(date '+%m %d %Y'))
echo "JD = ${JD}"
CD=$(JDATE_CAL ${JD})
echo "CD = ${CD}"
typeset -i10 MO
typeset -i10 DA
typeset -i10 YR
echo "${CD}" | read MO DA YR
echo "Month = ${MO} Day = ${DA} YR = ${YR}"
W1=$(WKDAY ${JD})
echo "Weekday = ${W1}"
Of course to do your 30, 60, and 90 day stuff you would first get the Julian Day of a value and add 30, 60, and 90 days to it before calling JDATE_CAL() for each of the values.
You can also yank the equivalent functions out of caljd.pl but if you want pure shell then the above functions should do the trick and should amaze you with their speed.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2002 02:01 PM
10-07-2002 02:01 PM
Re: Fast Julian Date Conversions
As usual your answer was right on! These functions are much faster and work just as well as caljd.sh.
Thanks again,
Mary Rice