- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Date problem
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
04-13-2005 07:15 AM
04-13-2005 07:15 AM
Is there a way in HP UNIX to find the difference in days between two dates?
TIA,
John
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2005 07:21 AM
04-13-2005 07:21 AM
Re: Date problem
I believe that is the name of the script. Will do all kinds of date calculations and math.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2005 07:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2005 07:35 AM
04-13-2005 07:35 AM
Re: Date problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2005 08:01 AM
04-13-2005 08:01 AM
Re: Date problem
I ran your example and it prints an error:
date.sh[5] 11 24 -4713 - 11 24 -4713 : syntax error
Did you mistype your example?
Thanks,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2005 08:24 AM
04-13-2005 08:24 AM
Re: Date problem
No but my psychic, Miss Cleo, tells me that you did. She said that my example was changed
from:
DT1="01 31 2005"
DT2="04 13 2005"
typeset -i DIFF=$(( $(caljd.sh ${DT2} - $(caljd.sh ${DT1}) ))
echo "Difference between ${DT2} and ${DT1} = ${DIFF} days."
to:
DT1="01/31/2005"
DT2="04/13/2005"
typeset -i DIFF=$(( $(caljd.sh ${DT2} - $(caljd.sh ${DT1}) ))
echo "Difference between ${DT2} and ${DT1} = ${DIFF} days."
Miss Cleo ran out of Windex so her crystal ball was a bit fuzzy; she couldn't quite see dates you entered but she could see the slashes.
If you are going to use dates like 01/31/2005 then you must add the -c and -S "/" arguments. All of this was in the usage messages if you had bothered to do a caljd.sh -u.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2005 08:51 AM
04-13-2005 08:51 AM
Re: Date problem
Thanks again,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2005 08:53 AM
04-13-2005 08:53 AM