First day of next month
Hi,
My requirement is to display the first day of next month when a month and year are selected in the dashboard prompt. .
I have 2 prompts, one for Month and the other for Year.
For example if an user selects 2012 for Year and 09(September) for Month, my column in the report should display 10/1/2012
Please help in getting this logic working.
I am using OBIEE 10.1.3
Use min(date), this always return first day of selected Year,month
Then add a month to this date.
Or else get the date of the month and use at DATE
TIMESTAMPADD(SQL_TSI_MONTH, 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( DATE) * -(1) + 1, DATE))
Pls mark as correct/helpful if helps
Appreciate if you update your other post with helpful/correct
Edited by: veeravalli on Oct 2, 2012 11:53 AM
Similar Messages
-
Function module to get the 'first day of next month'
Hi
I have a selection screen with input fields
1. period (month eg: 07)
2.year(fiscal year eg: 2008 )
If user enters 07 as month and 2008 as year, then I have to display 08/01/2008(MM/DD/YYYY) as output.
Requirement is to calculate the 'first day of next month'
I have written code for this requirement.But I am asked to use function mdule.
Please help me in this regard.
Thanks&Regards
Rama.Mekalahi try this FM ...
HR_JP_MONTH_BEGIN_END_DATE
it gives the Begin Date and End date of the month
rewards points if found useful
regards,
Balaji -
ABAP for the first day of the month
Hello BW users,
I have a scenario which uses an ODS with cumulative key figures with Addition update type. An infocube gets data from ODS by start routine in cube's update rule. I update this ODS first then infocube. All the loads are Full and are loaded daily. This is a snapshot scenario and I load the ods on itself then load from another infocube let's say Cube1. After successful load, I update infocube on itself again then update from the same infocube, Cube1, as in ODS. Infocube load sequence is same as ODS. In the scenario ODS and infocube are wanted to be updated daily. Therefore, I have to delete the ODS's (since it is addition update type) and infocube's overlapping data in the process chain that automates the load. At this point I need two things:
1- ABAP program that is going to give me the first day of each month.
2- ABAP program that is going to delete the overlapping data in ODS when I load it daily. Since I can do that for infocube in process chain with standard process type of Delete overlapping requests from infocube I need it only for ODS. Because there is no standard process type to delete overlapping requests in ODS (since its update type is Addition).
I appreciate your help. Thank you in advance.
Sincerely,1- ABAP program that is going to give me the first day of each month.
if sy-datun+6(2) = 01.
SY-FDAYW should give you the day
endif.
2- ABAP program that is going to delete the overlapping data in ODS
REPORT <PGM NAME>.
TABLES: RSODSACTREQ , rsseldone.
Parameters : odsname type RSINFOCUBE default '<>ODS NAME'.
DATA: temp_REQUEST LIKE RSODSACTREQ-REQUEST,
temp_REQUEST1 LIKE RSODSACTREQ-REQUEST,
temp_RNR LIKE rsseldone-RNR.
DATA: BEGIN OF itab OCCURS 0,
REQUEST LIKE RSODSACTREQ-REQUEST,
TIMESTAMP LIKE RSODSACTREQ-TIMESTAMP,
END OF itab.
DATA: BEGIN OF itab1 OCCURS 0,
RNR LIKE rsseldone-RNR,
seldate LIKE rsseldone-seldate,
seltime LIKE rsseldone-seltime,
END OF itab1.
SELECT REQUEST TIMESTAMP FROM RSODSACTREQ INTO TABLE itab
WHERE ODSOBJECT = '<ODS NAME>'.
SORT itab DESCENDING BY TIMESTAMP .
READ TABLE itab INDEX 1.
temp_REQUEST = itab-REQUEST.
SELECT RNR seldate seltime FROM rsseldone INTO TABLE itab1
WHERE source = '<Info Source Name for the ODS>'.
SORT itab1 DESCENDING BY seldate seltime .
READ TABLE itab1 INDEX 1.
temp_RNR = itab1-RNR.
*If temp_REQUEST = temp_RNR .
CALL FUNCTION 'RSSM_PROCESS_REQUDEL_ODSO'
EXPORTING
I_ODS = odsname
I_REQUEST = temp_REQUEST
I_JOBNAME = 'i_jobname'
I_VARIANT =
I_INSTANCE =
IMPORTING
E_ERROR =
E_T_MSG = itab1
E_T_RNRLIST = ITAB1.
*else.
*raise exception.
*endif.
clear itab.
refresh itab.
SELECT REQUEST TIMESTAMP FROM RSODSACTREQ INTO TABLE itab
WHERE ODSOBJECT = '<ODS NAME>'.
SORT itab DESCENDING BY TIMESTAMP.
READ TABLE itab INDEX 1.
temp_REQUEST1 = itab-REQUEST.
if temp_REQUEST = temp_REQUEST1.
raise exception .
endif. -
I have recently written my first stored procedure.
Its rather a bunch of SQL statements.
I had to hard code lot of dates. most of them are first day of the current monthe or last day of current month etc.
I thot of parametrizing all the dates, but if a business person has to include all the parameters they could go wrong and get the wrong results.
Now, I want to use date functions to achieve these requirements:
Can any one please throw some insght into this:....
1) First day of current month,
2) last day of current month.
3) first day of previious month
4) last day of previous month
5) first day of a month that is 3 months from now.
6) last day of a month that is 3 months from now.
7).....
Can any one please throw some light on any one of this.. I can try to work from there onwards ....
Thanks a lot in advance,
AcHi there,
1) First day of current month
select trunc(sysdate, 'MM') from dual;
2) last day of current month.
select trunc(add_months(sysdate, 1), 'MM') - 1 from dual;
3) first day of previious month
select trunc(add_months(sysdate, -1), 'MM') from dual;
4) last day of previous month
select trunc(sysdate, 'MM') - 1 from dual;
5) first day of a month that is 3 months from now.
select trunc(add_months(sysdate, 3), 'MM') from dual;
6) last day of a month that is 3 months from now.
select trunc(add_months(sysdate, 4), 'MM') - 1 from dual;cheers,
Anthony -
Hi,
I created a data parameter and I want my date parameter default value to be the first day of previous month, the expression {$FIRST_DAY_OF_MONTH()$} is pointing to the fitst day of current month and when I tried {$FIRST_DAY_OF_MONTH()-1$} it is just subtracting a day(thought to go back one month)...Is there way I can point my default value to first day of previous month.?
Regardshmm is BI Publisher in Beta? Are there any workarounds you can suggest me to achieve this?
I see the user stated that a workaround is possible at RTF template level? How can we achieve this?
Re: Default date as first of month
Edited by: user8937215 on Aug 10, 2010 7:30 AM -
I want the minimum of the horizontal axis to be the first day of the month.
I have a situation where I want the minimum of the horizontal
axis(with date time axis) to be the first day of the month. I
attempt it like so:
var max:Date = new Date();//current date is our max from
which we will calculate the min
var min:Date = new Date(max.fullYear,max.month,1);
dateTimeAxis.minimum = min;
However this first date on this axis is the last day of the
previous month for example 31 August instead of 1 September. Any
ideas how to fix?Nikos, the only thing I can think of (off hand) is that it's
defaulting to "zero" hour on that date, if you tried:
var min:Date = new Date(max.fullYear,max.month,1,13);
Would that make it work? That would set the date to 1pm.
Have you considered defining the axis with the data you are
binding to?
Cheers,
David -
Date for first day of current month
How can i get the date for first day of current month ?
select trunc(sysdate,'MM'),to_char(trunc(sysdate,'MM'),'DD'),to_char(trunc(sysdate,'MM'),'Day') from dual;
-
How to get the first day in the month from a domain date ?
Hi,
I like to know how to get the first day in the month from a domain date?
Thanks
StephenHi Gokul...
Instead of using the funtion module you can just write the 3 statements of code to get the first day of the week.
Its similar to the above one but instead of writing case statement you can achive the following.
data : w_res type i,
w_data type d,
w_res = w_date mod 7.
w_date = w_date - w_res.
write w_date.
This works.
Regards,
Siddarth -
How to get the first day of current month
hi guys,
i am trying to get the first day of current month which get from the date i input at the selection screen. my method is not so good, so i was wondering if there is better way to get the this,
thanks.Try this .
data : DAYNR LIKE HRVSCHED-DAYNR,
DAYTXT LIKE HRVSCHED-DAYTXT.
data langu like sy-langu value 'EN'.
Parameters PDATE LIKE SY-DATUM.
PDATE+6(02) = '01'.
CALL FUNCTION 'RH_GET_DATE_DAYNAME'
EXPORTING
LANGU = LANGU
DATE = PDATE
CALID =
IMPORTING
DAYNR = DAYNR
DAYTXT = DAYTXT
DAYFREE =
EXCEPTIONS
NO_LANGU = 1
NO_DATE = 2
NO_DAYTXT_FOR_LANGU = 3
INVALID_DATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE :/ PDATE, DAYNR, DAYTXT.
Cheers -
Scheule a job that runs on first day of every month
Hi i want to schedul a job (run a procedure ) on first day of every month . I have done something lije this
declare
nextdate date;
begin
SELECT trunc(add_months(sysdate,1),'MM') into nextdate FROM DUAL ;
dbms_output.put_line(nextdate);
dbms_job.submit(
what=>'someprocedure',
next_date=>nextdate,
interval=>'30');
end;
is interval mandatory ? how can i define that interval ??Hi,
You can define an interval as follows:
SQL> alter session set nls_date_format='dd-mm-yyyy hh24:mi:ss';
Session altered.
SQL> select add_months(trunc(sysdate, 'mm'), 1) from dual;
ADD_MONTHS(TRUNC(SY
01-09-2009 00:00:00
1 row selected.
SQL> select add_months(trunc(sysdate, 'mm'), 1) + 7/24 from dual;
ADD_MONTHS(TRUNC(SY
01-09-2009 07:00:00So, if you want your job to start at 07.00 every month you submit:
declare
nextdate date;
begin
SELECT trunc(add_months(sysdate,1),'MM') into nextdate FROM DUAL ;
dbms_output.put_line(nextdate);
dbms_job.submit(
what=>'begin someprocedure; end;',
next_date=>sysdate,
interval=>'add_months(trunc(sysdate, ''mm''), 1) + 7/24');
end; untested
Check the docs: http://tahiti.oracle.com
and/or http://asktom.oracle.com
and/or this forum as well.
Do some searches and you'll find lots of examples. -
How to get first day of the month by the given date?
Now, is there function in CRM system that can get the first day of the month ?
for example:
input date is 2007/12/12, then return 2007/12/01 (the first day of month).
Thank you~Hi ping,
data: w_date type sy-datum ,
w_temp(2) type c.
w_date = '20071212'.
w_temp = w_date+6(2).
w_temp = w_temp - 1.
w_date = w_date - w_temp.
write / w_date.
Plz Reward if useful,
Mahi. -
How to - get first DAY of the month from the date ?
Hi
pls helphi,
data : DAYNR LIKE HRVSCHED-DAYNR,
DAYTXT LIKE HRVSCHED-DAYTXT.
data langu like sy-langu value 'EN'.
Parameters PDATE LIKE SY-DATUM.
PDATE+6(02) = '01'.
CALL FUNCTION 'RH_GET_DATE_DAYNAME'
EXPORTING
LANGU = LANGU
DATE = PDATE
CALID =
IMPORTING
DAYNR = DAYNR
DAYTXT = DAYTXT
DAYFREE =
EXCEPTIONS
NO_LANGU = 1
NO_DATE = 2
NO_DAYTXT_FOR_LANGU = 3
INVALID_DATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE :/ PDATE, DAYNR, DAYTXT.
(OR)
Try..
DATA:DAYNR LIKE HRVSCHED-DAYNR,
DAYTXT LIKE HRVSCHED-DAYTXT,
DAYFREE LIKE HRVSCHED-NODAY.
DATA:LANGU LIKE SY-LANGU ,
DATE LIKE SY-DATUM,
CALID LIKE P1027-CALID VALUE 'US'.
date = sy-datum.
date+6(2) = 01. "----->to get the first day .
*first day of the month
write:/ 'First date of the month', date.
*Day name
CALL FUNCTION 'RH_GET_DATE_DAYNAME'
EXPORTING
langu = SY-LANGU
date = DATE
CALID = CALID
IMPORTING
DAYNR = DAYNR
DAYTXT = DAYTXT
DAYFREE = DAYFREE
EXCEPTIONS
NO_LANGU = 1
NO_DATE = 2
NO_DAYTXT_FOR_LANGU = 3
INVALID_DATE = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ DAYTXT.
Don't forget to reward if useful.... -
Is there any funcions available to pick up first day of the month?
I want to show the first month of the year given any date time stamp as input..
eg:
select sysdate from dual
assume sysdate is 10 Mar 2005
the output should be 10 Jan 2005.
We can take the last day of the month by using last_day
how to take the first day of the month given a input datetime?I want to show the first month of the year given any date time stamp as input..There is a little confusion with the thread's title.
We all answered you about your title question : how to obtain the first day of month, not the first month of year. For which you can test something like this :
SQL> select col1,add_months(col1,(-1*to_char(col1,'MM'))+1)
2 from (select to_date('10032007','DDMMYYYY') col1 from dual union all
3* select to_date('05012007','DDMMYYYY') col1 from dual )
SQL> /
COL1 ADD_MONT
10/03/07 10/01/07
05/01/07 05/01/07
SQL> Nicolas. -
Hi All,
In MYSQL any function is avaliable for get the FIRST DAY OF a month
LAST_DAY returns last day of the given date. Some thing like this?
Please adviceIn your ColdFusion code, an easy way to get the first day of the month would be along these lines:
<cfscript>
year = 2009;
month_number = 4;
if you don't want to/can't manually set the year and month you could do this
today = Now();
year = Year( today );
month_number = Month( today );
first_of_month = CreateDate( year,month_number,1 );
first_day_of_month = DayOfWeekAsString( first_of_month );
</cfscript>
The variable first_of_month will output April 1, 2009
The variable first_day_of_month will output Wednesday
If you're looking for something more specific to an issue in your application/code, please post some additional examples and details. -
Function for finding first day of the month !!
Hi,
I know we have function to find the last day(DD) of the month. Do we have any functions for finding the first day of the month ??? if not is there any way i can find the first date(DD) of the month .
Bcoz i m trying to incorporate the logic for finding the first day of the month partition.
Thank you!!!Shahid Ali Tcs wrote:
There are many solution given by member in relation with your question, and all are correct .
I want to make u know something else.
Have you ever think why oracle has given function for last_day but no function for first.....
I u think this question u will get the answer of your "first day finding " question.
Because first day is alwasy 01 of every, while last day can be 30,31,29,28.....
Got my words ........
One more solution from my side,,,,
SQL> select '01' || to_char(sysdate,'-MON-YY') from dual;
'01'||TO_
01-SEP-09Which is a completely poor way of doing it.
Using TRUNC or LAST_DAY(..) + 1 will return a DATE datatype result.
Your method is converting the DATE into a VARCHAR2, which then prevents further processing/date based calculations unless it is explicitly converted back to a DATE again.
The reason Oracle hasn't provided a FIRST_DAY is because the TRUNC function already caters for it as this works with DATE's as well as NUMBER's, not because the first day is always 1.
Maybe you are looking for
-
Lost Previous Downloaded Songs Help?
Received an iPod Shuffle for Christmas and have some problems. Redeemed a download card at iTunes Music Store while visiting my aunt. Downloaded (2) songs, worked with no problems. Now I go home and can't get the iTunes set-up disk to work on my home
-
How to reset my ipad "iPad is disabled"???
reset "I Pad is disabled" HOW do i reset???
-
Copying G4 Harddrive to Macbook Pro
How do you do it? I was told to start macbook holding down the "T" and then instructions should come up. I'm using a 400 to 800 firewire. Any ideas?? Many thanks in advance. Hannah
-
XMLForm Sorting by a form field
Hello, how can i sort a Renderlistitem by any of the fields in the form? I think that the layout set is not a solution, because the fields on the form aren´t available. The solution must be in the XMLForm Builder, isn´t it? Many thanks, António Olive
-
Javascript function prompt missing
Lanching my app in visual studio 2013 follwing message appears: