TO GET WEEKS for a given MONTH AND YEAR
Is there any FM to get the no of weeks for a given month, say 01 2005.
Can i get the week numbers say 1 2 3 4 5 for the given month and year.
Please let me know.
Happy Holidays.
Regards,
Manohar E
Hi Manohar,
Use FM DATE_GET_WEEK twice; first time pass first day of the month and again pass the last day of the month as a parameter. So u will be having week number(yyyyxx) for the first week of the month and week number for the last week of the month. From these two, in between week numbers u can easily fetch. I hope this will help u out.
Regards,
Kavya Shah
Similar Messages
-
Get the starting date and end date of all weeks of a given month and year
hey Guys so far I have this.. but I am having difficulty limiting it by month. I am using Oracle 11 release 1
Select year, week, next_day( to_date( '04-jan-' || year, 'dd-mon-yyyy' ) + (week-2)*7, 'sun' ) as weekStartDate,
next_day( to_date( '04-jan-' || year, 'dd-mon-yyyy' ) + (week-2)*7, 'sun' ) +6 as weekEndDate
from (Select '2012' year, rownum week from all_objects where rownum<=5)
Thanks in advance
Edited by: Aj05 on Jan 12, 2012 7:42 AMFirst you need to define week starting day. If, for example it is Monday:
TRUNC(TRUNC(&dt,'YYYY') -1,'IW')is first Monday of the year. Then:
SELECT TRUNC(TRUNC(&dt,'YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
FROM DUAL
CONNECT BY LEVEL <= 53
/will give start dates of all weeks within &dt year. And:
WITH t AS (
SELECT TRUNC(TRUNC(&dt,'YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
FROM DUAL
CONNECT BY LEVEL <= 53
SELECT week_start_date,
week_start_date + 6 week_end_date
FROM t
WHERE week_start_date > TRUNC(&dt,'MM')
AND week_start_date < ADD_MONTHS(TRUNC(&dt,'MM'),1)
/will give you week start/end dates within &dt year and month. For example:
SQL> DEFINE dt="DATE '2012-03-17'"
SQL> WITH t AS (
2 SELECT TRUNC(TRUNC(&dt,'YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
3 FROM DUAL
4 CONNECT BY LEVEL <= 53
5 )
6 SELECT week_start_date,
7 week_start_date + 6 week_end_date
8 FROM t
9 WHERE week_start_date > TRUNC(&dt,'MM')
10 AND week_start_date < ADD_MONTHS(TRUNC(&dt,'MM'),1)
11 /
old 2: SELECT TRUNC(TRUNC(&dt,'YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
new 2: SELECT TRUNC(TRUNC(DATE '2012-03-17','YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
old 9: WHERE week_start_date > TRUNC(&dt,'MM')
new 9: WHERE week_start_date > TRUNC(DATE '2012-03-17','MM')
old 10: AND week_start_date < ADD_MONTHS(TRUNC(&dt,'MM'),1)
new 10: AND week_start_date < ADD_MONTHS(TRUNC(DATE '2012-03-17','MM'),1)
WEEK_STAR WEEK_END_
05-MAR-12 11-MAR-12
12-MAR-12 18-MAR-12
19-MAR-12 25-MAR-12
26-MAR-12 01-APR-12
SQL> SY. -
How to get classification for a given material and material type in MM
Hello Friends,
One of my developer colleagues is struggling to find out : how to get classification for a given material and material type in MM?
He is looking for probable table and table fields to Select from.
I would appreciate seriously any help in this regard.
~Yours SincerelyHi
Below given the flow and table details for a given class and class type.
- Table KLAH --> This contains the "Internal class no" [ for the given Class & Class type ]
- Table KSML --> This contains the " internal character numbers " [ nothing but characteristics attached to the class ] , which can be fetched with the above fetched internal class no
- Table AUSP --> This table contains the objects ( material ) attached to the internal characters of that class
- Table CABNT --> This table contains the "Description" for the internal character numbers.
- award points if this is ok -
I want to accumulate rain for the day, month and year; What formula can I use?
I want to accumulate rain for the day, month and year; What formula or expression can I use.
I am using a Rain Wise product that converts pulses to an analog value. The Rain Wise device can be
set to measure up to 1", 5", or 10". I will be setting the unit to 10 inches in increments of 0.01 inches.
What I would like to do is everytime the signal increments I would like to count it as 0.01 then after reaching
a period of time whether it be a day or a month reset back to zero.
Need some advise on this problem.
Solved!
Go to Solution.Hello Ryan,
Lookout gets a Modbus over Ethernet signal which originates as a 4-20mA input to a Moxa Ethernet I/O Module (E1240) in the field. In Lookout I created a ModbusEthernet Driver and a tag which scales 0 - 65534 RAW to 0-10 Eng. [0 - 10 is inches of rain] Also, another piece of information is that after the rain gauge maxes out at 10 inches it will zero out and start over.
I though the accumulator was time based and took a sample over a specific time period, for instance, one sample every 30 seconds then accumulate. If this is so then if I have 5 inches of rain and then it stopped raining, then 30 seconds latter it would sample, it would see 5 inches and add that to be 10 inches when actually it had only rained 5 inches.
I really need some help with this process,
David Lopez
City of Corpus Christi -
Need working days for a particular month and year
Hi,
I need the number of working days for a particular month and year.Saturdays and Sundays are holidays.
Regards,
VigneshTry this:
SQL> var yr NUMBER;
SQL> exec :yr := 2010;
PL/SQL procedure successfully completed.
SQL> with t as (select :yr yr from dual)
2 SELECT TO_CHAR(dat,'MON-RR'),COUNT(*) FROM
3 (select TO_DATE('01-JAN-'||yr) + lv dat FROM
4 (select level - 1 lv,yr from t
5 connect by level <= TO_DATE('31-DEC-'||yr) - TO_DATE('01-JAN-'||yr) + 1))
6 WHERE TO_CHAR(Dat,'DY') NOT IN ('SAT','SUN')
7 GROUP BY TO_CHAR(dat,'MON-RR');
TO_CHAR(DAT, COUNT(*)
APR-10 22
AUG-10 22
DEC-10 23
FEB-10 20
JAN-10 21
JUL-10 22
JUN-10 22
MAR-10 23
MAY-10 21
NOV-10 22
OCT-10 21
TO_CHAR(DAT, COUNT(*)
SEP-10 22
12 rows selected.
SQL> Edited by: AP on Jul 27, 2010 7:54 AM -
Looking for formula to fill dates of particular days of week for a given month
Hi
I have a Numbers document with a sheet for each month of the year, named "January", "February", "March", etc.
Each sheet contains a table as follows:
I am looking for a function that will calculate the dates in a given month that I am due to see each client, based on the year (contained in a single cell table on a seperate sheet) and the month of the sheet (I am presuming that a function can refer to the name of a sheet). These dates would populate the cells under "Session 1", "Session 2", etc. (for some days of the week there may be only four sessions, for others five).
I hope this is clear, and would be grateful for any help in getting this working.
Thanks,
NickHere's an example, using September, 2011 as the month.
Main Table:
A1: =DATE(Year :: A2,9,1)
This calculates the Date and Time value for midnight at the beginning of the first day of the ninth month of the year indicated in cell A2 of the table "Year" (September 1, 2011). It uses a Custom format to display only the month and year of this date. The Dates calculated in the rest of the table depend on the Date and Time value in this cell.
A2 - A11: Entered data. Not used in calculations.
B2 - B10: Entered data. The text values here are used as search-for values, and must match the text values in column A of the table Weekday lookup.
C2, Filled down to C10: =$A$1+MOD(7-WEEKDAY($A$1)+VLOOKUP(B,Weekday lookup :: $A:$B,2,FALSE),7)
This calculates the Date corresponding to the first occurrence of the weekday indicated in B during the month in A1. The result is a Date and Time value (used in formulas to the right). The cells use a custom format to display only the Day (of the month) number.
D2, Filled right to column F and down to row 10: =C+7
Calculates the date seven days after the date in column C.
G2, filled down to row 10: =IF(MONTH($A$1)=MONTH(F+7),F+7,"")
This is the same formula as used in D2, but adds a check to suppress the calculation if the result is not in the same month as other dates on the table.
Year: The requested single cell table to record the year.
Weekday Lookup: A lookup table from which to retrieve the weekday number for the day in column B of the main table.
Custom formats:
Select cells C2 - G10
Open the Inspector > Cell Format Inspector > Date and Time
Delete the unwanted elements from the workspace in the Inspector.
Repeat for cell A1.
Regards,
Barry
PS: Numbers cannot use the Sheet name or Table name as data for a formula unless the name is placed into a cell on a table.
B -
How to get currect date by using month and year
hai,
By using month like 'Jul' and year like 2007 i want to get full date like 01/06/2007(format).Please give me query for this?My fields for month and year are respectively vr_mnth(varchar) and in_year(number)i used to_date function but it accepts only one string .if i give like this
to_date(vr_mnth,in_year,'dd/mm/yy') it will gives me syntax error.
If i give like this vr_mtnh='Jan'
to_date(vr_mtnh,'Mon') it will give output
01/01/2008 it shows me current year
if i choose from table wich is strored with month-'Jul' and year=2006 it shows me
01/07/2008 only .It doesn't shows me that 2006 year
If i give in_year in to_date it gives me that currect year.
Ex:to_date(in_year,'YY')..............>01/01/2006
Individually to_date function works fine but i want to club both to get accurate date format of specified month and year.Is there any function for that in sql to get 01/07/2006? -
Find the difference between two dates for the specific month and year
Hi,
I have two dates, start date is 30/12/2012 and end date is 04/01/2013. Using datediff I found the difference of days between two dates. But I find the no of days in January 2013. ie output is 4 instead of 6. I input month and year to find the no of days
for that date. In this case I input Jan 2013. How can I sql this ?I don't understand how most of the answers provided here not analytically solving the problem with many cases possible.
First let me understand you:
You have 2 dates range and you want to calculate day range for specific month and year between the original date range.
declare @for_month int = 1 --January
declare @for_year int = 2013
declare @StartDate date = '2012-12-20'
declare @EndDate date = '2013-01-04'
SELECT
CASE
WHEN (DATEPART(MONTH, @StartDate) = @for_month and DATEPART(MONTH, @EndDate) = @for_month) and ((DATEPART(YEAR, @StartDate) = @for_year or DATEPART(YEAR, @EndDate) = @for_year)) THEN
DATEDIFF(DAY, @StartDate,@EndDate)
WHEN (@StartDate < cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) and (@EndDate between (cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) and (cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date))) THEN
DATEDIFF(DAY, DATEADD(MONTH, DATEDIFF(MONTH, -1, @EndDate)-1, 0),@EndDate)
WHEN (@EndDate > cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date)) and (@StartDate between (cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) and (cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date))) THEN
DATEDIFF(DAY, @StartDate,DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, @StartDate) + 1, 0))) + 1
WHEN ((DATEDIFF(DAY, @StartDate, cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date)) >= 0) and (DATEDIFF(DAY, cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date), @EndDate) >= 0)) THEN
DATEDIFF(DAY, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as datetime), DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as datetime)) + 1, 0))) + 1
ELSE
0
END as [DD]
I don't know how you calculate day range between 01/01/2013 and 04/01/2013
is 4, it is actually is 3 but if that is the case, you can add 1 from the condition. -
Table for Material Quantity and Value for particular month and year
Hi All
My requirement is that for a particular month and year I want to know the stock quantity and stock value for a particular material for a given plant.From which SAP table can I get this data as I want to fetch data for my Y report?
Regards
Satish KumarHi,
You can use MB5B table as suggested earlier.also you can use:
MBEW-VMKUM --> stock for previous month period
MBEW-VJKUM --> stock for previous year period
PLease view these links which migh tbe helpful to you:
http://help.sap.com/saphelp_47x200/helpdata/en/39/55fee3bc6111d4b3960050dadf0791/content.htm
TableStock
Thanks
Nisha -
How to save and month and year wise values
Hi friends,
in my ztable i have to enter values manually for month and year wise..
so i have to create parameter for month and year how to create it.
in my parameter month and year fields..
once he given month and year then he should enter values for fields..
i have doubt how to give parameter for this...table..
example: month: 1
year : 2007
after that user enter values for following fields.
kunnr
name
core values
noncorevalues
above fields user will enter values month wise ..
once he enter the values for january it should save ...
next he enter values for february and it will save..
when ever he want to see the january month data how can he see..
is there any logic for the above problem...Hai venkat,
I am not totally clear with your question some how i understood. I give my opinion may be it ll help ful to you.
In your ztable you want to enter the values for the fields kunnr, name, core values ,noncorevalues as per month.
As i say in your ztable add another field as month with other 4 fields. Provide the table maintenance for your table or else in se11 -> table display ->utilities -> table contents -> create entries is one way.
If you proivided maintenance for your table go to SM30. where you can manually enter values .
<b>reward if useful</b>
Regards,
sunil kairam. -
Month and Year on slider Movement.
Hi,
I am a newbie to XCelsius. I want to show and take the value of Month and Year (in format 'mmm-yy') up to last 12 months. But I am not able to convert the number which I get from slider to the Month and Year.
Regards,
Neel.
Edited by: Neel Kulkarni on Jan 28, 2009 7:58 AMHi Neel,
I think you can do this with a vlookup. You would provide a set of cells which would provide the basis of the lookup and your slider would be the first arguement.
The spreadsheet should look like this
Item, Date, Formatted Date
0, 29/01/2009, 01 2009
0, 01/12/2008, 12 2008
0, 01/11/2008, 11 2008
0, 01/10/2008, 10 2008
0, 01/09/2008, 09 2008
0, 01/08/2008, 08 2008
0, 01/07/2008, 07 2008
0, 01/06/2008, 06 2008
0, 01/05/2008, 05 2008
0, 01/04/2008, 04 2008
0, 01/03/2008, 03 2008
0, 01/02/2008, 02 2008
Once you have this (assuming from A1:C12) and with your slider value at D1 you can do a lookup
=vlookup(D1, A1:C12, 3,false)
and this will return appropriate value.
The difficulty will be filling the date as Excel does not have a DateAdd function. The simplest approach would be to load this data via QaaWS or Live Office if you have that facility. If not you could write something like the following
=DATE(IF((MONTH(TODAY())-A2)>0,YEAR(TODAY()), YEAR(TODAY())-1),IF((MONTH(TODAY())-A2)>=0,12,MONTH(TODAY())-A2),1)
This is a bit buggy, as I have not time to debug it properly.
You would then use the TEXT function to get the data in the format you want (you will have to extend this so that it converts 01 to Jan etc
=TEXT(MONTH(B1), "00")&" "&TEXT(YEAR(B1), "00")
Let me know how you get on
Regards
Alan -
Itunes Match won't upload. I get error stating there was an error in the itunes store, please try again. I have tried again everyday for the last month and am still unable to use. Any ideas on why Match can't complete the 1st step of the process (Gathering information about your Itunes library)?
JohnCullison wrote:
For the last few weeks, the iTunes store has been displayed with empty graphic rectangles (with a blue box containing a white question mark centered in the rectangles), bits of text, and some buttons. The page extends quite a ways, including what I assume would be all the links to all the music...
If all you are trying to do is buy music, you can easily buy MP3s at any online music download store (e.g. amazon.com) and add them to your iTunes library. -
How to get Week,Month and Year details from a date column
Hi frenz,
I've a column like tran_date which is a date column..... I need the next week details based on this column and so on...
I need month and year details as well based on this tran_date column.... can any one tell me how...
Thanks in advanceMy example for objects:
create or replace type date_object as object
centure number,
year number,
month number,
day number,
hour number,
minute number,
second number,
daypart number,
week number,
constructor function date_object(p_dt date)
return SELF as result
create or replace type body date_object is
constructor function date_object(p_dt date)
return SELF as result
as
begin
SELF.centure:= trunc(to_char(p_dt,'YYYY')/100);
SELF.year:= to_char(p_dt,'YYYY');
SELF.month:= to_char(p_dt,'MM');
SELF.day:= to_char(p_dt,'DD');
SELF.hour:= to_char(p_dt,'HH24');
SELF.minute:= to_char(p_dt,'MI');
SELF.second:= to_char(p_dt,'SS');
SELF.daypart:= p_dt-trunc(p_dt,'DD');
SELF.week:= to_char(p_dt,'IW');
return;
end;
end;
select date_object(sysdate),
date_object(sysdate).year
from dual;Regards,
Sayan M. -
How to get the date of first day of a week for a given date
Hi gurus
can any one say me how to get the date of first day(date of Sunday) of a week for a given date in a BW transformations. For example for 02/23/2012 in source i need to get 02/19/2012(Sunday`s date) date in the result. I can get that start date of a week using BWSO_DATE_GET_FIRST_WEEKDAY function module. But this function module retrieves me the start date as weeks monday(02/20/2012) date. But i need sundays(02/19/2012) date as the start date. So it would be really great if anyone sends me the solution.
Thanks
RavHi,
The simplest way would be to subtract 1 from the date date which you are already getting in transformation routine, but instead of doing that subtraction manually which might need bit of errort, you can simply use another FM to subtract 1 from given date.
RP_CALC_DATE_IN_INTERVAL
Regards,
Durgesh. -
Function module for getting month and year of the previous month (say -6)
Hi,
Is there a function module that will get you the month and year of say, a month before, and as far as 11 months ago.
For example, say today is 6/2007. I want 7 months ago.
How do i get this value?
What function module or method is available?
Points will be rewarded and responses will be appreciated.
Thank You,
JohnHi
lv_period gives the month and year which is two months earlier now as we have specified lv_months as -2.
DATA: LV_PERIOD LIKE S001-SPMON,
LV_MONTHS(2) TYPE C VALUE '2-',
LV_DATUM LIKE SY-DATUM,
LV_NEWDT LIKE SY-DATUM,
P_SPMON LIKE S001-SPMON VALUE '200601'.
CONCATENATE P_SPMON '01' INTO LV_DATUM.
LV_PERIOD = P_SPMON+0(6).
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
MONTHS = LV_MONTHS
OLDDATE = LV_DATUM
IMPORTING
NEWDATE = LV_NEWDT
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC = 0.
LV_PERIOD = LV_NEWDT+0(6).
ENDIF.
WRITE :/ LV_PERIOD.
OR
Use the following FM for getting the year and the month based on date
CACS_DATE_GET_YEAR_MONTH
or
Call Function 'CCM_GO_BACK_MONTHS '.
Funny module: 03/31/2002 - 1 month = 02/31/2002
OR
RE_ADD_MONTH_TO_DATE ( Add / substract month to/from date )
Need ur reward points.
Best regards,
Ravi
Maybe you are looking for
-
Appalling customer service. Problem with Infinity ...
Placed order for upgrade from Bt Broadband to Infinity 1 on Tuesday 19th March. Was given installation date of Tuesday 26th March (Today). All started well when engineer arrived at 9am. He had already done the necessarys in the cabinet up the road so
-
Need help writing application to call another class
Hello All, this is only the second program I have ever written and I am lost. I am supposed to write one application that will encrypt a four digit number by 1st replacing each diigt with the result of adding 7, then getting the remainder after divid
-
I would like to use my IPhone with a simcard of a foreign country telephone company.
I presently use my phone in the USA with an AT&T account. I live part of the time in South America. I would like to use the same IPhone while in South America with my account I have with "Tigo" (a wireless telephone provider). Tigo has a license to o
-
Please help!!! someone has added a pocker app to my account i need to know how to remove it?
-
Error code mem_/2/5
Hi, I have this error code on my Imac G3 and no software will open without immediately crashing - any advice? Do I need to get a new memory stick? I noticed there were other questions regarding an error code mem_/2/4 - is this the same problem?