Solved

How to get dates for fiscal quarters for report generation based on year

Posted on 2008-10-08
3
862 Views
Last Modified: 2013-12-18
I am writing a store procedure , which generates reports for every fiscal quarter.

I am passing YEAR as input argument -- input_arg_year , and we have start and end ( day and months for fiscal quarters as constants)

now my question is how can i append start and end dates with the year( input_arg_year)  to form a valid date. which can be used further in my store proc, for report generation.
 Ex: Jan1st is quarter start date and input arg is 2008
       date = 01012008 .......something like this

let me know, how can i append and convert the string into a valid date.

give an example , so that can understand easily , i am a naive developer ( basically asp.net developer)
0
Comment
Question by:Swetha_aJaX
3 Comments
 
LVL 73

Expert Comment

by:sdstuber
ID: 22675816
given  a string '01012008'  that could be interpreted as ddmmyyyy  or mmddyyyy


so, depending on which way you intend your data to be structured you use the to_date function


for example....  

select to_date('01012008','mmddyyyy') date_format_1,  to_date('01012008','ddmmyyyy') date_format_2 from dual
0
 

Author Comment

by:Swetha_aJaX
ID: 22677566
can you give some example of how to append the input argument with the date.

i tried this way -- qrtr_start_dt := '0101' + input_arg_date;

is the above interpretation correct?
0
 
LVL 9

Accepted Solution

by:
jamesgu earned 500 total points
ID: 22677582
to append start and end dates with the year( input_arg_year) , use ||
to convert a string to date, use sdstuber' s example

a quick example

declare
start_date varchar(10) := '0101';
input_arg_year varchar(10) := '2008';
startDate date;
begin
select to_date(start_date || input_arg_year, 'mmddyyyy') into startDate from dual;
--dbms_output.put_line(startDate);

end;
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I am very much excited today since I'm going to share something very exciting Tool used for Analytical Reporting and that's nothing but MICROSTRATEGY. Actually there are lot of other tools available in the market for Reporting Such as Co…
How to increase the row limit in Jasper Server.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now