Generate quarter dates with begin date and end date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Generate quarter dates with begin date and end date
# 8  
Old 06-07-2010
Hi Tyler,

Yep it is 2009-10-01, typo

I mean suppose if I give the input as sdate as 2009-10-01 and edate as 2010-05-31

I have to get following output:

Code:
2009-10-01 2009-12-31 09Q04
2010-01-01 2010-03-31 10Q01
2010-04-01 2010-05-31 10Q02

But from your code, I get the following output:

Code:
2009-10-01 2009-12-31 09Q04
2010-01-01 2010-03-31 10Q01
2010-04-01 2010-06-30 10Q02

And if I give input as sdate as 2009-10-01 and edate as 2010-06-30


I have to get following output:

Code:
2009-10-01 2009-12-31 09Q04
2010-01-01 2010-03-31 10Q01
2010-04-01 2010-06-30 10Q02

I have tried modying the code as you said, it is giving the fllowing error:

Useless use of numeric lt (<) in void context at qtr_dates.pl line 26.


TIA
# 9  
Old 06-07-2010
Quote:
Originally Posted by sol_nov
...I have tried modying the code as you said, it is giving the fllowing error:

Useless use of numeric lt (<) in void context at qtr_dates.pl line 26.
...
What did you try ?

tyler_durden
This User Gave Thanks to durden_tyler For This Post:
# 10  
Old 06-07-2010
Code:
if (($edate[0],$edate[1],$edate[2]) < @y) {
    @y = ($edate[0],$edate[1],$edate[2]);
}
else
{ @y = Add_Delta_YMD($edate[0],1,1, 0,$eadd_mon,-1);
}

I am not sure, if what I am doing is right... correct me if I am wrong here

Last edited by Franklin52; 06-08-2010 at 05:14 AM.. Reason: Please use code tags!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Splitting week start date and end date based on custom period start dates

Below are my custom period start and end dates based on a calender, these dates are placed in a file, for each period i need to split into three weeks for each period row, example is given below. Could you please help out to achieve solution through shell script.. File content: ... (2 Replies)
Discussion started by: nani2019
2 Replies

2. Linux

How to calculate the quarter end date according to the current date in shell script?

Hi, My question is how to calculate the quarter end date according to the current date in shell script? (2 Replies)
Discussion started by: Divya_1234
2 Replies

3. UNIX for Dummies Questions & Answers

Print start date to end date, given $1 & $2 in ksh

Dear all, I have an user passing 2 parameter 31/03/2015 and 02/04/2015 to a ksh script. How to print the start date to end date. Expected output is : 31/03/2015 01/04/2015 02/04/2015 Note : 1. Im using aix and ksh 2. I have tried to convert the given input into a date, didnt... (0 Replies)
Discussion started by: mr.rajaravi
0 Replies

4. Shell Programming and Scripting

Get 1st date of month, week , quarter

Hi , I need to trigger few jobs based on the system date ( in case user is not passing any date to the script. In case passing then need to take the user date). Here is the requirement 1. Everyday call daily script 2. On 1st day of week call weekly script 3. On 1st day of month call... (4 Replies)
Discussion started by: Anupam_Halder
4 Replies

5. UNIX for Dummies Questions & Answers

Find Quarter Start and End Dates

Dear Members, Depending on the current date i should find out the start and end dates of the quarter. ex: Today date is 14-Nov-2011 then Quarter start date should be Oct 1 2011 and Quarter End date should be Dec 31 2011. How can i do this? Thanks Sandeep (1 Reply)
Discussion started by: sandeep_1105
1 Replies

6. Shell Programming and Scripting

ksh compare dates INSIDE a file (ie date A is > date B)

In KSH, I am pasting 2 almost identical files together and each one has a date and time on each line. I need to determine if the first instance of the date/time is greater than the 2nd instance of the date/time. If the first instance is greater, I just need to echo that line. I thought I would... (4 Replies)
Discussion started by: right_coaster
4 Replies

7. Shell Programming and Scripting

Need to capture dates between start date and end date Using perl.

Hi All, Want to get all dates and Julian week number for that date between the start date and end date. How can I achive this using perl? (To achive above functionality, I was connecting to the database from DB server. Need to execute the same script in application server, since databse... (6 Replies)
Discussion started by: Nagaraja Akkiva
6 Replies

8. Shell Programming and Scripting

Need to capture all dates between start date and End date.

Hi All, I enter Start date and end date as parameters. I need to capture dates between start date and end date. Please let me know if you have any idea the same. Thanks in advance. Nagaraja Akkivalli. (5 Replies)
Discussion started by: Nagaraja Akkiva
5 Replies

9. UNIX for Dummies Questions & Answers

Get Quarter Date

Hi I need to produce a report that the start date must be the first day of the current quarter. Therefore a repor that is run today the start date would be 01/10/2010 (ddmmyyyy). Obvioulsy I could hard code this date in but what happens when the report is run in January the start of the... (6 Replies)
Discussion started by: theref
6 Replies
Login or Register to Ask a Question