How to get week number and day in my result?
hi experts, i have given the data is ID and DATE(yyyymmdd),i want to get output like ID,DATE,WEEKNO,YEAR,MONTH,DAY. how to get this output.
thanks & regards
vijay
In a routine transformation you can call function
DATE_GET_WEEK
to get the week number from the date.
To determ the others, use the substring
YEAR = DATE(4)
MONTH = DATE+4(2)
DAY = DATE+6(2)
Similar Messages
-
How to get total number of days
Hi All,
how to get total number of days , for example if month eq 05 then need to get total number of days until MAY 31.
and how to get total number of days in a month.
Thank You,,
Sriii..Hi Sridhar,
Pls Try to search before posting general questions.
Try this,
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = p_lv_date1
i_datum_von = p_lv_date2
IMPORTING
e_tage = p_e_date_difference
EXCEPTIONS
days_method_not_defined = 1
OTHERS = 2
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Sunil kairam. -
How to get customer number and name from the SD document
Hi All,
Can you please let me know how to get Customer Number and Name from the SD Document?
Thanks a lot....
AnilHi,
It will be displayed in the SD (BIlling document) itself, you clikc on the VF03. The customer name and number will also appear in the SO document also Tcode VA03
regards,
radhika
Edited by: kolipara radhika on Jul 10, 2009 5:32 AM -
How to get the number of columns in a result set???
hi everyone..
i am trying to establish a servlet applet communication....
my applet send the sql query to the servlet as serialised string and then the servlet executes the query...
Since i need to pass the result back to the applet, i thaught of passing the whole reult set to the applet..but that seems to be not possible..
so i thaught of storing my result set data in a vector and then pass the vector,but the first problem that i came across is that how to get the number of colums in a result set....
so is there a way to get the number of columns in a result set...???
and also i would like to know if it possible to send my whole result set to the applet bye serialization or by any method...???
thanx in advanceYou shouldn't do. It expenses resources (you should always close the ResultSet and the Statement as fast as possible). Simply gently process it into a Collection or Map of DTO's. Those are serializable.
-
Get week number for day from a list of days within a year..
I am beginning in ORACLE / SQL and wondering how I can use this query to work with a column of Dates that span over a number of years?
Ideally, I would like to use this script to add a number for the week of the year based on this.
Then when a new year begins to start over..
I am referencing an old thread..
TO_CHAR with dates to get week number issue
Here is what I have so far:
I keep getting an error stating "Bind Variable "p_date_beg" is NOT DECLARED"..
Thanks in advance for any help you can provide.
DECLARE
p_date_beg DATE;
BEGIN
SELECT RETRIEVAL_DATE
INTO P_DATE_BEG
FROM OBS_SELECT_LST12_SPG;
WITH TAB AS
(SELECT TO_DATE(TO_CHAR(:p_date_beg,'YYYYMM')||'01','YYYYMMDD') + LEVEL -1 DATE_COL
FROM DUAL
CONNECT BY LEVEL <=TO_NUMBER(TO_CHAR(LAST_DAY(:p_date_beg),'DD')))
SELECT DATE_COL, TO_CHAR(DATE_COL, 'FMDAY') DAY,
(CASE
WHEN TO_CHAR(TRUNC(DATE_COL, 'mm'),'FMDAY') = 'SUNDAY'
THEN TO_NUMBER(TO_CHAR(DATE_COL,'W'))
ELSE CEIL((TO_CHAR(SYSDATE, 'dd') + 1 - TO_CHAR(NEXT_DAY(TRUNC(SYSDATE, 'mm'), 'SUNDAY'), 'dd'))/7)
END) WEEK_NOB
END;hi, referring to this link about ISO week, http://www.epochconverter.com/date-and-time/weeknumbers-by-year.php, here is the code:
/* Formatted on 2012/06/13 06:32 (Formatter Plus v4.8.8) */
WITH t AS
(SELECT MIN (TO_DATE ('20120101', 'rrrrmmdd') + LEVEL - 1)
start_date,
1 week_th
FROM DUAL
WHERE TO_CHAR ( TRUNC (TO_DATE ('20120101', 'rrrrmmdd'), 'mm')
+ LEVEL
- 1,
'FMDAY'
) = 'MONDAY'
AND ( TO_DATE ('20120101', 'rrrrmmdd') + LEVEL - 1 <
TRUNC (NEXT_DAY (TO_DATE ('20120101', 'rrrrmmdd'),
'THU'
OR (TO_DATE ('20120101', 'rrrrmmdd') + LEVEL - 1
BETWEEN TRUNC (NEXT_DAY (TO_DATE ('20120101',
'rrrrmmdd'
'THU'
AND TRUNC (NEXT_DAY (TO_DATE ('20120101',
'rrrrmmdd'
'THU'
+ 7
CONNECT BY LEVEL < 15),
v AS
(SELECT t.start_date + 7 * (LEVEL - 1) start_date,
t.week_th + LEVEL - 1 week_th
FROM t
CONNECT BY LEVEL < 53),
u AS
(SELECT '20120501' dt
FROM DUAL
UNION ALL
SELECT '20120502'
FROM DUAL
UNION ALL
SELECT '20120503'
FROM DUAL
UNION ALL
SELECT '20120504'
FROM DUAL
UNION ALL
SELECT '20120505'
FROM DUAL
UNION ALL
SELECT '20120506'
FROM DUAL
UNION ALL
SELECT '20120507'
FROM DUAL
UNION ALL
SELECT '20120508'
FROM DUAL
UNION ALL
SELECT '20120509'
FROM DUAL)
SELECT *
FROM u, v
WHERE TO_DATE (u.dt, 'rrrrmmdd') BETWEEN v.start_date AND (v.start_date + 6);output:
DT START_DATE WEEK_TH
20120501 30/04/2012 18
20120502 30/04/2012 18
20120503 30/04/2012 18
20120504 30/04/2012 18
20120505 30/04/2012 18
20120506 30/04/2012 18
20120507 07/05/2012 19
20120508 07/05/2012 19
20120509 07/05/2012 19 -
Week number and days in week number
Hi, All
we have to update the material master with weekly forcast sales, so can any one tell me which <b>function i have to use to get week numbers in a month ( i have to get all the week numbers in the given month) and once i get the week numbers how should i get the number of days in each week number</b> so that i can update the material master based on the week numbers,Try the function module:
GET_WEEK_INFO_BASED_ON_DATE -
How to get the number of days in a month?
hi all
is there any way to get the number of days in a given month with a given year? for instance, if year is 2004 and the month is July or February, how can i get the number of days? thanks.Gee, I don't know ... Maybe this:
Calendar cal = Calendar.newInstance();
cal.set(Calendar.YEAR, 2004);
cal.set(Calendar.MONTH, Calendar.FEBUARY);
System.out.println("max days in month: " + cal.getActualMaximum(Calendar.DAY_OF_MONTH));
Do you not bother reading what people have already posted? Read the API docs on the Calendar class. -
How to get week number from date
Hi,
please mention how to get the number of week from a particular date using fn module?Hi Debarshi,
Use FM <b>DATE_GET_WEEK</b>
Reward points if helpful.
Regards,
Hemant -
How to get total number of days in current Fiscal period/year
Hi,
I need to get total number of days in current Fiscal period/year (current month) and assign it to an infoobject. I need a routine for this. Is there any function module to get this.If possible pls paste the ABAP code also for this task. Thanks in advancehere is the FM:
LAST_DAY_IN_PERIOD_GET
KJ!!! -
hai bloggers,
see we have 365 days per year for first half we are going to have 180+ days (if we select first half as the prompt and we select week number as prompt and the last date of that particular week should show in the report)and number of days upto that date or week also should display...if we select second half and week number of that particular half it should show number of days upto that week and highest date of that week number of days should count from 1 to 180+ only mean (july 1 st is 1 st day)
thanksYou need to use timestampdiff function for calculating number of days. One of the way to calculate is like this
case when "Time"."Calendar Half Year" = 1 then timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-01'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),CAST(EVALUATE('TO_DATE(%1,%2)','30-06'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE)) else timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-07'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),CAST(EVALUATE('TO_DATE(%1,%2)','31-12'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE)) end
If you want calculate between 1st day of the half and last date of a week then use following
case when "Time"."Calendar Half Year" = 1 then timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-01'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),MAX(MAX("Time"."Calendar Date"))) else timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-07'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),MAX(MAX("Time"."Calendar Date"))) end
Hope it will answer your question
Thanks,
Phani. -
How to get the number of days of February.....
Hi ,
how can I get the number of days (28 or 29) of February of the current year or the next...????
Or is there any other way to find that a year is a leap or not (i mean the year has 365 or 366 days).??
Thanks
Simonselect add_months(to_date('&v_year', 'YYYY'), 12) -
to_date('&v_year', 'YYYY') from dual;Jens, it seems we have made the same mistake, trunc usage seems mandatory :
SQL> ed
Wrote file afiedt.buf
1* select add_months(to_date('2007', 'YYYY'), 12) - to_date('2007', 'YYYY') from dual
SQL> /
ADD_MONTHS(TO_DATE('2007','YYYY'),12)-TO_DATE('2007','YYYY')
366
SQL> ed
Wrote file afiedt.buf
1* select add_months(trunc(to_date('2007', 'YYYY'), 'YYYY'), 12) - trunc(to_date('2007', 'YYYY'), 'YYYY') from dual
SQL> /
ADD_MONTHS(TRUNC(TO_DATE('2007','YYYY'),'YYYY'),12)-TRUNC(TO_DATE('2007','YYYY')
365
SQL> Just to clarify my past doubt.
Nicolas. -
How to get equipment number and type for given PM order
hello all,
i know the PM order number and corresponding object number (like OR9100000175),
now using these how do i get equipment number and equipment type..
do i need to use any function module...
thanks in advance...From VBAK table with order number AUFNR, get notification no - QMNUM.
From QMIH table with this notification no QMNUM, get equipment no - EQUNR.
And then from equipment master EQUI, you can get the equipment categeory EQTYP from EQUNR -
How to get imei number and mac address of mobile device on adf mobile
Hi experts,
I need to get imei number and mac address of device (supposed to be works on both android and iphone) on adf mobile
bgrdsHi,
Adf mobile support phonegap api. Version must be 2.0(you can check it by below code snippet) You can just reach uuid from both platform via cordova. Espescially, IOS restriction limits you to get device infos that you mentioned, but you can get uuid.
getCordovaVersion = function ()
var cordovaVersion = device.cordova;
return cordovaVersion;
getDeviceUUID = function ()
var uuid = device.uuid;
return uuid; -
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 number of days of a month belonging to a date interval
Hi, i am getting mad around a problem, i have 2 dates and a month, i wanto to retrieve the number of days belonging to the month that are in the interval.
eg:
month january 2011 . begin_date = 11/JAN/2011, END_DATE 30/MAY/2011 result is 21
month january 2011 . begin_date = 11/DEC/2010, END_DATE 10/JAN/2011 result 10
month january 2011 .begin_date = 02/FEB/2011 , END_DATE 25/may/2011 result 0
month january 2011. begin_date = 03/JAN/2011 , END DATE 05/JAN/2011 result 3
and so on ...
i appreciate any suggestion
thank you
AndreaOh, I didnt see your result.
SQL> with t as
2 (select to_date('11/01/11','dd/mm/yy') from_dt,
3 to_date('30/05/11','dd/mm/yy') to_dt,
4 'Jan-11' mnth from dual
5 union all
6 select to_date('11/12/10','dd/mm/yy') from_dt,
7 to_date('10/01/11','dd/mm/yy') to_dt,
8 'Jan-11' mnth from dual
9 union all
10 select to_date('02/02/11','dd/mm/yy') from_dt,
11 to_date('25/05/11','dd/mm/yy') to_dt,
12 'Jan-11' mnth from dual
13 union all
14 select to_date('03/01/11','dd/mm/yy') from_dt,
15 to_date('05/01/11','dd/mm/yy') to_dt,
16 'Jan-11' mnth from dual
17 )
18 select from_dt,to_dt,mnth,
19 greatest(
20 least(last_day(to_date(mnth,'Mon-yy')),to_dt)
21 -
22 greatest(to_date(mnth,'Mon-yy'),from_dt)+1
23 ,0) cnt
24 from t;
FROM_DT TO_DT MNTH CNT
11-JAN-11 30-MAY-11 Jan-11 21
11-DEC-10 10-JAN-11 Jan-11 10
02-FEB-11 25-MAY-11 Jan-11 0
03-JAN-11 05-JAN-11 Jan-11 3
Maybe you are looking for
-
Is this possible? Help needed - Please :)
Hi All, Is there a way I can make a script or something that, with a shortcut button or icon, copy some preset folders from one place to another, make a new mailbox and name them something specific? I hope that makes sense. I have no idea if this is
-
Create n tables with different number names
Hi guys, I work with SQL Server 2008 and OS Windows Server 2008 R2 64 bits. I have to create 10 tables with different names e.g. 'Image1', 'Image2', and so on. For this goal, I use a loop and concatenation. Here is the code: DECLARE @i INT DECLARE @v
-
How can I recover photos if I updated software and the backup to the cloud did not complete?
-
Getting large XmlType column content
Help! I have table with XMLType column, and when fetch date, see an error message like buffer to small (ora 19011). How can i fetch date content to clob or anythig else... Or what is a better solution?
-
With Oracle JDeveloper 10g (10.1.3) Developer Preview, I tried to make a simple jsp page as in this tutorial: http://www.oracle.com/technology/obe/obe9051jdev/visual_jsp/intro_to_visual_jsp.htm I only added some text then right-clicked file, selected