- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to count the number of Mondays, Tuesdays e...
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
тАО09-13-2006 08:54 PM
- Tags:
- date arithmetic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2006 08:58 PM
тАО09-13-2006 08:58 PM
Re: How to count the number of Mondays, Tuesdays etc between two given dates ?
Search forums for caljd.sh
- Tags:
- caljd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2006 09:02 PM
тАО09-13-2006 09:02 PM
Re: How to count the number of Mondays, Tuesdays etc between two given dates ?
search inside this thread for the word caljd.
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=123030
latest version of this script can be downloaded from.
http://mirrors.develooper.com/hpux/index.html#Contrib
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2006 09:07 PM
тАО09-13-2006 09:07 PM
Re: How to count the number of Mondays, Tuesdays etc between two given dates ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2006 09:09 PM
тАО09-13-2006 09:09 PM
Re: How to count the number of Mondays, Tuesdays etc between two given dates ?
http://mirrors.develooper.com/hpux/caljd-2.2.pl
regards,
Robert-Jan
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2006 09:16 PM
тАО09-13-2006 09:16 PM
Re: How to count the number of Mondays, Tuesdays etc between two given dates ?
can i have a small script which I can insert into my perl cgi program ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2006 09:33 PM
тАО09-13-2006 09:33 PM
Re: How to count the number of Mondays, Tuesdays etc between two given dates ?
once you have the script:
1. strip out the '-' out of the date
2. convert the start date to Julian with '-y' option.
3. Same for end date
4. run a loop while start date < end date
5. use -w to get the weekday
6. case statement to add 1 to the Mon,Tue,Wed... array
7. end of loop
8. Print out your array
Bourne version of this attached
- Tags:
- missing attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-13-2006 11:47 PM
тАО09-13-2006 11:47 PM
SolutionOne way is to use Perl's Date::Calc module. You can verify your dates (if necessary) with its 'check_date' function and determine the difference between a set of dates with its 'Delta_Days' function.
If you want to roll-you-own, you can use the Time::Local module; regular expressions or unpack() to parse your dates; convert to epoch secnods and determine the delta value in days.
Once you have the number of days, inclusive or exclusive of the range points, a "div 7" will give you the number of Mondays, Tuesdays or whatever represented the day associated with the beginning date.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 02:18 AM
тАО09-14-2006 02:18 AM
Re: How to count the number of Mondays, Tuesdays etc between two given dates ?
The reason that this script is so large is primarily argument parsing and usage and examples but also providing NLS support adds to the complexity but in any event the subroutines that you need are very small.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2006 02:22 AM
тАО09-14-2006 02:22 AM
Re: How to count the number of Mondays, Tuesdays etc between two given dates ?
log of my earlier post:
$ ./x.sh "2006-09-14" "2006-09-22"
Start Julian: 2453993
End Julian: 2454001
Mondays : 1
Tuesdays : 1
Wednesdays : 1
Thursdays : 2
Fridays : 1
Saturdays : 1
Sundays : 1