recurrence for every sunday for Date::MAnip in perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting recurrence for every sunday for Date::MAnip in perl
# 1  
Old 01-20-2009
recurrence for every sunday for Date::MAnip in perl

Hi,

I have a requirement to define all Saturdays/Sundays of every month in a year as holidays. I am making use of Date::Manip package available in perl.

I tried writing a recurrence as :

0:1*3:7:0:0:0 --> this relation helps me to define 3rd Sunday of a year as sunday.

My requirement is to define a single recurrence relation for all Saturdays/Sundays.

Any help will be highly appreciated.
# 2  
Old 01-29-2009
From the Date::Manip man pages....
Quote:
Values to the right of the asterix can be listed a single values, ranges (2 numbers separated by a dash "-"), or a comma separated list of values or ranges.
...
If the week element is non-zero and the day element is non-zero, it refers to the day of the week. It can be any value from 1 to 7 (negative values -1 to -7 are also allowed). If you use the ISO8601 convention, the first day of the week is Monday (though Date::Manip can use any day as the start of the week by setting the FirstDay config variable).
....
If the week element is zero and the month element is non-zero, the day value is the day of the month (it can be from 1 to 31 or -1 to -31 counting from the end of the month). If a value of 0 is given, it defaults to 1.
So you need a non-zero week, an asterisk, and a comma-separated list of non-zero days. I haven't tried this, but I think this would work:

0:0:1*6,7:0:0:0
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Yesterday's Date if it is Sunday

Hi All, Can you please let me know how to get the yesterday's date of the given date if the given date is Sunday? I can't use GNU. I have the code to get the yesterday's date based on the system date. Thanks (5 Replies)
Discussion started by: shash
5 Replies

2. Shell Programming and Scripting

Fetch date of 7 years back from current date in Perl

$beginDate = substr(DateCalc("today", "-7Days"),0,8); This fetches the date 7 days back Can I fetch the date before 7 years from todays date in Perl using same syntax Use code tags, see PM. (3 Replies)
Discussion started by: parthmittal2007
3 Replies

3. Shell Programming and Scripting

How to derive the last Sunday's date when Current date value is passed

Hi All, I have a requirement in my project where a batch runs on any day of a week. The input files will land to the server every Sunday. I need to read these files based on the current BUS_DAY (which falls any day of the week). For e.g : if the BUS_DAY is 20120308, we need to derive the... (3 Replies)
Discussion started by: dsfreddie
3 Replies

4. Shell Programming and Scripting

how to find out recurrence and print it.

Hi all, I have a file having data like this: rs4332761 15XB rs4332761 unk rs4571228 15XB rs457263 5XB rs4606515 10XA rs4606515 10XB rs4606515 15XB I want output like this: rs4332761 15XB,unk rs4571228 15XB rs457263 5XB rs4606515 10XA,10XB,15XB I... (2 Replies)
Discussion started by: pirates.genome
2 Replies

5. Shell Programming and Scripting

awk to print count for chars recurrence

input: 123456 1111 124567 2222 125678 3333 234567 aaaa 456789 abcd awk logic: - read lines for recurring 1st 2 chars of the 1st field - if recurrence detected count up and print value output: 1 123456 1111 2 124567 2222 3 125678 3333 (6 Replies)
Discussion started by: ux4me
6 Replies

6. Shell Programming and Scripting

Last sunday of current date

Hi Please help me with this problem i need to find the date of last week sunday from the current given date (12 Replies)
Discussion started by: aishsimplesweet
12 Replies

7. UNIX for Dummies Questions & Answers

How to find last sunday (date) using perl?

How to find last sunday (date) using perl? Eg, If i run today (26-Feb-2008 / Tuesday), I should get 24-Feb-2008 (Sunday). Any help? (3 Replies)
Discussion started by: deepakwins
3 Replies

8. Shell Programming and Scripting

Date - Last Sunday thru Saturday

Hi All, I have to kick off a script on every Monday to get some data from database for last week (Sunday thru Saturday). If its Monday (12/12/2005) Begin date will be Sunday - 12/4/2005 End date will be Saturday - 12/10/2005 The script might not kick off on some Mondays. So my... (2 Replies)
Discussion started by: skymirror
2 Replies
Login or Register to Ask a Question