Find the 'DAY' for a given 'DATE'
Hi Folks,
I need a help regarding finding the day for a given date.
My requirement is that..,
If I enter a date using 'parameters', it should write the 'day' for the corresponding date.
To be more specific.....,
if I enter date as ' 07/15/2008 ' it should return me the day as 'Tuesday'.
Regards,
Naveen G
HI,
FM LIST WITH RESPECT TO DAY, WEEK, AND MONTH.
CALCULATE_DATE : Calculates the future date based on the input .
DATE_TO_DAY : Returns the Day for the entered date.
DATE_COMPUTE_DAY : Returns weekday for a date
DATE_GET_WEEK : Returns week for a date
RP_CALC_DATE_IN_INTERVAL : Add days / months to a date
MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.
END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.
HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.
FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.
MONTH_NAMES_GET : Get the names of the month
WEEK_GET_FIRST_DAY : Get the first day of the week
HRGPBS_HESA_DATE_FORMAT : Format the date in dd/mm/yyyy format
SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours
L_MC_TIME_DIFFERENCE : Find the time difference between two date/time
HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months
LAST_DAY_OF_MONTHS : Returns the last day of the month
DATE_CHECK_PLAUSIBILITY :Check for the invalid date.
Reward points if useful,
siri
Similar Messages
-
Find 3rd friday of the month for a given date
how to find out 3rd friday of the month for a given date? I can always pass the first day of the month as input
eg, input date is 01-JAN-09. need to get the 3rd friday 16-JAN-09 (Jan has 5 fridays 02, 09, 16,23,30)
input date : 01-feb-09, need to get 20-feb-09
Edited by: user520824 on Apr 1, 2009 12:30 PMNLS independent solution:
SELECT DT,
TO_CHAR(DT,'FMDay') day,
CASE
WHEN TRUNC(TRUNC(DT,'MM') + 7,'IW') - 3 < TRUNC(DT,'MM') THEN TRUNC(TRUNC(DT,'MM') + 7,'IW') + 18
ELSE TRUNC(TRUNC(DT,'MM') + 7,'IW') + 11
END THIRD_FRIDAY_OF_THE_MONTH
FROM (
SELECT TO_DATE(LEVEL || '/2009','MM/YYYY') DT
FROM DUAL
CONNECT BY LEVEL < 13
DT DAY THIRD_FRI
01-JAN-09 Thursday 16-JAN-09
01-FEB-09 Sunday 20-FEB-09
01-MAR-09 Sunday 20-MAR-09
01-APR-09 Wednesday 17-APR-09
01-MAY-09 Friday 15-MAY-09
01-JUN-09 Monday 19-JUN-09
01-JUL-09 Wednesday 17-JUL-09
01-AUG-09 Saturday 21-AUG-09
01-SEP-09 Tuesday 18-SEP-09
01-OCT-09 Thursday 16-OCT-09
01-NOV-09 Sunday 20-NOV-09
DT DAY THIRD_FRI
01-DEC-09 Tuesday 18-DEC-09
12 rows selected.
SQL> SY. -
How to get start date of the period for a given date from cube
I have a situation where i need to find the start day of the period for a given date. is there a way to know that. i want to use that in my report. i enter the date from my report(i have date parameter), depends on the date, i want to display the start day
of the period. how can i write expression for that in my report?
ramHi ramprasad74,
According to your description, you are using Analysis Services as a data source for the report, the cube has hierarchy: Fyear, FQuarter, FPeriod, fweek, Fdate. You want to add a date parameter to the report, after you changed value of the parameter, the
report will return the first day of FPeriod.
To achieve your goal, we need to add a parameter to the report, then use the parameter in mdx query. For detail information, please refer to the following steps:
In the Report Data pane, right-click on a dataset created from a SQL Server Analysis Services data source type, and then click Query. The MDX query designer opens in Design mode.
On the toolbar, click Design to toggle to Query mode.
On the MDX query designer toolbar, click Query Parameters symbol. The Query Parameters dialog box opens.
In the Parameter column, click <Enter Parameter>, and then type the name of a parameter.
In the Dimension column, choose a value from the drop-down list.
In the Hierarchy column, choose a value from the drop-down list.
In the Default column, from the drop-down list, select a single value.
Click OK.
In query designer dialog box, type the mdx query like below:
with member [Measures].[FirstChild]
as
[Date].[Fiscal].currentmember.parent.firstchild.name
select {[Measures].[FirstChild]} on 0,
[Date].[Fiscal].[Date].members on 1
from
( SELECT ( STRTOSET(@ParameterName, CONSTRAINED) ) on 0
from
[Cube]
Here are relevant threads you can reference:
https://social.msdn.microsoft.com/forums/sqlserver/en-US/c7146ac3-40ea-4d53-b321-c707aebbd405/how-to-pass-date-parameter-to-mdx-query
https://social.msdn.microsoft.com/forums/sqlserver/en-US/fd12a865-bc90-4a65-af42-ce38a8cfa29b/pass-date-time-parameter-to-mdx-query-ssrs
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
If you have any feedback on our support, please click
here. -
How to know the day of a given date?
Hello Experts,
Is there any function module that can give the day of a given date? For example, If
I put in 10/30/2007, it will give me Tuesday. Hope you can help me guys.Thank you and take care!Hi
Yes, DATE_COMPUTE_DAY
Sample code:
clear: hold_day_of_week.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
DATE = workdate
IMPORTING
DAY = day_of_week_num
EXCEPTIONS
OTHERS = 8.
CASE day_of_week_num.
WHEN 1.
hold_day_of_week = 'Monday'.
WHEN 2.
hold_day_of_week = 'Tuesday'.
WHEN 3.
hold_day_of_week = 'Wednesday'.
WHEN 4.
hold_day_of_week = 'Thursday'.
WHEN 5.
hold_day_of_week = 'Friday'.
WHEN 6.
hold_day_of_week = 'Saturday'.
WHEN 7.
hold_day_of_week = 'Sunday'.
WHEN OTHERS.
hold_day_of_week = 'invalid'.
ENDCASE.
or
You can use DATE_COMPUTE_DAY to get the day number of the week (for example, today gives 5)
then use WEEKDAY_GET which returns an itab with seven entries (one for each day of the week.)
You enter in this itab and get the field langt to get the day name.
code @ http://www.sap-img.com/abap/fm-to-get-the-day-for-a-particular-date.htm
Pls reawrd points -
How to find the day of a particular date
Hi,
I am working on an app which will display 15 days in retrospect with the date and day for any entered date. For example if the user enters June 15, 2001 the app has to display dates from June 1 and the corresponding day of those dates like sunday, monday... Is there any function which would help me.use the java.text.SimpleDateFormat and java.util.Calendar classes
// look at the javadocs for SimpleDateFormat for mor info about the formatting
// string that is passed to the constructor
// the format below translates to : "Fri, Aug 17, 2001"
SimpleDateFormat formatter = new SimpleDateFormat ( "EEE, MMM d, yyyy" );
Calendar cal = Calendar.getInstance();
Date theDate = new Date();
cal.setTime( theDate );
for ( int i=0; i<15; i++ ) {
String dateStr = formatter.format( cal.getTime() );
System.out.println( dateStr );
cal.add( Calendar.DAY_OF_YEAR , -1 );
}output of this code:
Fri, Aug 17, 2001
Thu, Aug 16, 2001
Wed, Aug 15, 2001
Tue, Aug 14, 2001
Mon, Aug 13, 2001
Sun, Aug 12, 2001
Sat, Aug 11, 2001
Fri, Aug 10, 2001
Thu, Aug 9, 2001
Wed, Aug 8, 2001
Tue, Aug 7, 2001
Mon, Aug 6, 2001
Sun, Aug 5, 2001
Sat, Aug 4, 2001
Fri, Aug 3, 2001 -
Find The Transaction for the given EXIT Name
Hi Friends,
This is my doubt,pls dont think in the other sense
I know how to find the EXIT for a given Transaction. My question is that IS THERE IS ANY WAY TO FIND THE TRANSACTION FOR A GIVEN EXIT NAME.Could any one help me out on this.My fuctional guys are giving me the EXIT names and asking me to find for which transaction the exit triggers.
Thanks & Regards
Vijaya Lakshmihi lakshmi,
try the following steps.
1. give the exit name in SMOD.(J45A0007) go to display mode
2. click component and take the exit name.(EXIT_SAPMJ45A_009)
3. here SAPMJ45A is the progam name, so that in SE38 give the progame name click the Where used button and select the transaction and deselect other checkbox.
4. you will get the transaction code.
Reward if found helpful.
Regards,
Boobalan Suburaj -
Get the Stock for a given Material no
Hi,
I'm an ABAP consultant, new to MM.
I have a requirement - For a given Production Order I have to find the Material and respective BOM Explosion. Once that is done I have to get the Stock for those Materials [Child Materials].
I have used AUFK and AFPO to get the material from the Production Order and Used MAST table to get the other details and passed it to FM - 'CS_BOM_EXPL_MAT_V2' - This gives me the Child materials.
Now I want to know how can I find the Stock for a given Material. I want to get the Overall Unrestricted stock. Which Table do I have to use. Is there any standard Function Module [FM] or BAPI to get it.
Please help.
Thanks & Regards,
AshishI have gone through the MARD table. I want to confirm - for a Material no there are more than 1 plant and for each plant there are more than storage location. So I have to add the Unrestricted Stock of all those to get the Full Unrestricted Stock.
Please refer Transaction MMBE - I have to use that output. -
How to find the Day on a Week for any given Date
Hi..... I need your help to find out the Day on a Week for any given Date .
Say if the Date is 31/12/2009 , what would be the Day on a Week for this Date.
Are there any fucntions available to determine the same?
Please let me know....Thanks in Advance
Regards
SmitaHi ,
You can using the following peice of code to get the Day of a Week for the given date :
Calendar now = Calendar.getInstance();
System.out.println("Current date : " + (now.get(Calendar.MONTH) + 1)
+ "-" + now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR));
//create an array of days
//Day_OF_WEEK starts from 1 while array index starts from 0
String[] strDays = new String[]{"Sunday", "Monday", "Tuesday", "Wednesday", "Thusday", "Friday", "Saturday" };
String day_of_week = strDays[now.get(Calendar.DAY_OF_WEEK) - 1];
System.out.println("Current day is : " + strDays[now.get(Calendar.DAY_OF_WEEK) - 1] );
Edited by: Ritushree Saha on Jun 4, 2009 1:09 PM -
To find the no of working days b/w given date
Hi ABAP Experts,
Here i have one requirement .
table is tfacs
in this table i want to know the no of working days b/w the given date. Here i have attached my code .pls go through it and do me needful.
TABLES : tfacs,vbrk.
DATA: BEGIN OF ty_tfacs OCCURS 0,
ident TYPE tfacs-ident,
jahr TYPE tfacs-jahr,
mon01 TYPE tfacs-mon01,
mon02 TYPE tfacs-mon02,
mon03 TYPE tfacs-mon03,
mon04 TYPE tfacs-mon04,
mon05 TYPE tfacs-mon05,
mon06 TYPE tfacs-mon06,
mon07 TYPE tfacs-mon07,
mon08 TYPE tfacs-mon08,
mon09 TYPE tfacs-mon09,
mon10 TYPE tfacs-mon10,
mon11 TYPE tfacs-mon11,
mon12 TYPE tfacs-mon12,
basis TYPE tfacs-basis,
fenum TYPE tfacs-fenum,
wenum TYPE tfacs-wenum,
load TYPE tfacs-load,
string1(31) TYPE c,
string2(31) TYPE c,
string3(31) TYPE c,
string4(31) TYPE c,
string5(31) TYPE c,
string6(31) TYPE c,
string7(31) TYPE c,
string8(31) TYPE c,
string9(31) TYPE c,
string10(31) TYPE c,
string11(31) TYPE c,
string12(31) TYPE c,
uk(31) TYPE c,
total1 TYPE i,
total2 TYPE i,
total3 TYPE i,
total4 TYPE i,
total5 TYPE i,
total6 TYPE i,
total7 TYPE i,
total8 TYPE i,
total9 TYPE i,
total10 TYPE i,
total11 TYPE i,
total12 TYPE i,
END OF ty_tfacs.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_jahr FOR tfacs-jahr MODIF ID b1.
SELECT-OPTIONS : mon FOR tfacs-mon01 MODIF ID b1.
SELECT-OPTIONS : s_month FOR vbrk-erdat MODIF ID b2.
SELECTION-SCREEN : END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME.
PARAMETERS r1 RADIOBUTTON GROUP c DEFAULT 'X' USER-COMMAND flag .
PARAMETERS r2 RADIOBUTTON GROUP c .
SELECTION-SCREEN END OF BLOCK b.
INITIALIZATION
INITIALIZATION.
AT SELECTION-SCREEN OUTPUT.
IF r1 NE space.
LOOP AT SCREEN.
IF screen-group1 EQ 'B2'.
screen-output = 1.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-group1 EQ 'B1'.
screen-output = 1.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
start - of - selection
start-of-selection.
IF r1 = 'X'.
PERFORM get-data.
PERFORM display-data.
ENDIF.
& form get-data
text
--> p1 text
<-- p2 text
form get-data .
DATA : total1 TYPE i.
SELECT * FROM tfacs INTO TABLE ty_tfacs
WHERE ident EQ 'IN'
AND jahr IN s_jahr.
LOOP AT ty_tfacs WHERE ident = 'IN'.
IF sy-subrc EQ 0.
PERFORM get_string USING ty_tfacs-string1
ty_tfacs-mon01
ty_tfacs-total1.
PERFORM get_string USING ty_tfacs-string2
ty_tfacs-mon02
ty_tfacs-total2.
PERFORM get_string USING ty_tfacs-string3
ty_tfacs-mon03
ty_tfacs-total3.
PERFORM get_string USING ty_tfacs-string4
ty_tfacs-mon04
ty_tfacs-total4.
PERFORM get_string USING ty_tfacs-string5
ty_tfacs-mon05
ty_tfacs-total5.
PERFORM get_string USING ty_tfacs-string6
ty_tfacs-mon06
ty_tfacs-total6.
PERFORM get_string USING ty_tfacs-string7
ty_tfacs-mon07
ty_tfacs-total7.
PERFORM get_string USING ty_tfacs-string8
ty_tfacs-mon08
ty_tfacs-total8.
PERFORM get_string USING ty_tfacs-string9
ty_tfacs-mon09
ty_tfacs-total9.
PERFORM get_string USING ty_tfacs-string10
ty_tfacs-mon10
ty_tfacs-total10.
PERFORM get_string USING ty_tfacs-string11
ty_tfacs-mon11
ty_tfacs-total11.
PERFORM get_string USING ty_tfacs-string12
ty_tfacs-mon12
ty_tfacs-total12.
ENDIF.
ty_tfacs-uk = ty_tfacs-total1 + ty_tfacs-total2
+ ty_tfacs-total3 + ty_tfacs-total4
+ ty_tfacs-total5 + ty_tfacs-total6
+ ty_tfacs-total7 + ty_tfacs-total8
+ ty_tfacs-total9 + ty_tfacs-total10
+ ty_tfacs-total11 + ty_tfacs-total12.
MODIFY ty_tfacs TRANSPORTING total1 total2 total3
total4 total5 total6
total7 total8 total9
total10 total11 total12
uk.
ENDLOOP.
PERFORM write1-data USING 'COU' 'YEAR' 'MONTH01'
'MONTH02' 'MONTH03' 'MONTH04'
'MONTH05' 'MONTH06' 'MONTH07'
'MONTH08' 'MONTH09' 'MONTH10'
'MONTH11' 'MONTH12' 'TOTAL WDAYS' .
LOOP AT ty_tfacs.
PERFORM write1-data USING ty_tfacs-ident ty_tfacs-jahr
ty_tfacs-total1 ty_tfacs-total2
ty_tfacs-total3 ty_tfacs-total4
ty_tfacs-total5 ty_tfacs-total6
ty_tfacs-total7 ty_tfacs-total8
ty_tfacs-total9 ty_tfacs-total10
ty_tfacs-total11 ty_tfacs-total12
ty_tfacs-uk.
ENDLOOP.
ENDFORM. " get-data
TOP-OF-PAGE.
FORMAT COLOR 5 ON.
WRITE :/10 'COUNTRY',
20 'YEARS',
35 'MON01',
45 'MON02',
55 'MON03',
65 'MON04',
75 'MON05',
85 'MON06',
95 'MON07',
105 'MON08',
115 'MON09',
125 'MON10',
135 'MON11',
145 'MON12',
170 'total wdays'.
FORMAT COLOR OFF.
WRITE :/ SY-ULINE.
*& Form display-data
text
--> p1 text
<-- p2 text
FORM display-data .
LOOP AT ty_tfacs.
WRITE :/10 ty_tfacs-ident,
20 ty_tfacs-jahr,
30 ty_tfacs-total1,
40 ty_tfacs-total2,
50 ty_tfacs-total3,
60 ty_tfacs-total4,
70 ty_tfacs-total5,
80 ty_tfacs-total6,
90 ty_tfacs-total7,
100 ty_tfacs-total8,
110 ty_tfacs-total9,
120 ty_tfacs-total10,
130 ty_tfacs-total11,
140 ty_tfacs-total12,
150 ty_tfacs-uk.
ENDLOOP.
ENDFORM. " display-data
*& form get_string
text
-->p_0250 text
-->p_0251 text
-->p_0252 text
form get_string using p_0250 " month
p_0251 " string
p_0252. " total
p_0250 = p_0251. " move month to string
TRANSLATE p_0250 USING '0 ' . " translate
CONDENSE p_0250 NO-GAPS. " condense
p_0252 = STRLEN( p_0250 ). " pass length of string to total
ENDFORM. " get_string
***& Form write1-data
text
-->P_0306 text
-->P_0307 text
-->P_0308 text
-->P_0309 text
-->P_0310 text
-->P_0311 text
-->P_0312 text
-->P_0313 text
-->P_0314 text
-->P_0315 text
-->P_0316 text
-->P_0317 text
-->P_0318 text
-->P_0319 text
-->P_0320 text
*form write1-data using p_0306
p_0307
p_0308
p_0309
p_0310
p_0311
p_0312
p_0313
p_0314
p_0315
p_0316
p_0317
p_0318
p_0319
p_0320.
*WRITE :/ p_0306,
p_0307,
p_0308 left-justified,
p_0309 left-justified,
p_0310 left-justified,
p_0311 left-justified,
p_0312 left-justified,
p_0313 left-justified,
p_0314 left-justified,
p_0315 left-justified,
p_0316 left-justified,
p_0317 left-justified,
p_0318 left-justified,
p_0319 left-justified,
p_0320 left-justified.
*ENDFORM. " write1-data
from this report what i am getting is year and its 12 months but my requirement is i will give date using select options and i should get the total no of working days in b/w this date.Use the following code to find no of working days b/w given date. Use the correct factory_calendar_id in the function module. L_DAYS will display the required result:
PARAMETERS: p_date1 TYPE sydatum,
p_date2 TYPE sydatum.
DATA: date1 LIKE scal-date,
date2 LIKE scal-date,
correction LIKE scal-indicator,
calendar LIKE scal-fcalid,
factorydate1 LIKE scal-facdate,
workday1 LIKE scal-indicator,
factorydate2 LIKE scal-facdate,
workday2 LIKE scal-indicator,
l_days TYPE scal-facdate.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
date = p_date1
correct_option = '+'
factory_calendar_id = 'US'
IMPORTING
date = date1
factorydate = factorydate1
workingday_indicator = workday1
EXCEPTIONS
correct_option_invalid = 1
date_after_range = 2
date_before_range = 3
date_invalid = 4
factory_calendar_not_found = 5.
IF sy-subrc = 0.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
date = p_date2
correct_option = '+'
factory_calendar_id = 'US'
IMPORTING
date = date2
factorydate = factorydate2
workingday_indicator = workday2
EXCEPTIONS
correct_option_invalid = 1
date_after_range = 2
date_before_range = 3
date_invalid = 4
factory_calendar_not_found = 5.
IF sy-subrc = 0.
l_days = factorydate2 - factorydate1.
WRITE: / l_days.
ENDIF.
ENDIF. -
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. -
Getting the week number for a given date
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 64-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
Hello all.
I am currently migrating our product from SQL SERVER to ORACLE and have the following issue.
Basically I'm just trying to get the year week number for a given date but I'm having trouble with Oracle as it seems to think that the weeks run from Thursday to Thursday?. I presume this is something to do with the fact that the first day of the year was Thursday?
e.g.
SQL SERVER:
select DATEPART(wk, '2009-10-24') as Sat -- 43 - correct
select DATEPART(wk, '2009-10-25') as Sun -- 44 - correct
select DATEPART(wk, '2009-10-26') as Mon -- 44 - correct
select DATEPART(wk, '2009-10-27') as Tue -- 44 - correct
select DATEPART(wk, '2009-10-28') as Wed -- 44 - correct
select DATEPART(wk, '2009-10-29') as Thu -- 44 - correct
select DATEPART(wk, '2009-10-30') as Fri -- 44 - correct
select DATEPART(wk, '2009-10-31') as Sat -- 44 - correct
select DATEPART(wk, '2009-11-1') as Sun -- 45 - correct
select DATEPART(wk, '2009-11-2') as Mon -- 45 - correct
select DATEPART(wk, '2009-11-3') as Tue -- 45 - correct
select DATEPART(wk, '2009-11-4') as Wed -- 45 - correct
select DATEPART(wk, '2009-11-5') as Thu -- 45 - correct
ORACLE:
SELECT to_char(to_date('24-OCT-2009'), 'ww') as Sat from dual; -- 43 correct
SELECT to_char(to_date('25-OCT-2009'), 'ww') as Sun from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('26-OCT-2009'), 'ww') as Mon from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('27-OCT-2009'), 'ww') as Tue from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('28-OCT-2009'), 'ww') as Wed from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('29-OCT-2009'), 'ww') as Thu from dual; -- 44 correct
SELECT to_char(to_date('30-OCT-2009'), 'ww') as Fri from dual; -- 44 correct
SELECT to_char(to_date('31-OCT-2009'), 'ww') as Sat from dual; -- 44 correct
SELECT to_char(to_date('1-NOV-2009'), 'ww') as Sun from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('2-NOV-2009'), 'ww') as Mon from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('3-NOV-2009'), 'ww') as Tue from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('4-NOV-2009'), 'ww') as Wed from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('5-NOV-2009'), 'ww') as Thu from dual; -- 45 correct
Now I don't want to get into a discussion with regard to locales etc.
In my world (and is seems SQL SERVER's) the first day of the week is Sunday and the last Saturday.
Is there some NLS_? setting or something that I'm missing?
thanks for any help on this.
AndyThis is what you need.
SELECT ceil(( 7+(trunc(to_date('25-OCT-2009'),'d')-trunc(to_date('25-OCT-2009'),'Y')) )/7) FROM dual
HTH!!!
--tested all these statements.
Works as you wish!!
SELECT ceil(( 7+(trunc(to_date('24-OCT-2009'),'d')-trunc(to_date('24-OCT-2009'),'Y')) )/7) as Sat from dual;
SELECT ceil(( 7+(trunc(to_date('25-OCT-2009'),'d')-trunc(to_date('25-OCT-2009'),'Y')) )/7) as Sun from dual;
SELECT ceil(( 7+(trunc(to_date('26-OCT-2009'),'d')-trunc(to_date('26-OCT-2009'),'Y')) )/7) as Mon from dual;
SELECT ceil(( 7+(trunc(to_date('27-OCT-2009'),'d')-trunc(to_date('27-OCT-2009'),'Y')) )/7) as Tue from dual;
SELECT ceil(( 7+(trunc(to_date('28-OCT-2009'),'d')-trunc(to_date('28-OCT-2009'),'Y')) )/7) as Wed from dual;
SELECT ceil(( 7+(trunc(to_date('29-OCT-2009'),'d')-trunc(to_date('29-OCT-2009'),'Y')) )/7) as Thu from dual;
SELECT ceil(( 7+(trunc(to_date('30-OCT-2009'),'d')-trunc(to_date('30-OCT-2009'),'Y')) )/7) as Fri from dual;
SELECT ceil(( 7+(trunc(to_date('01-NOV-2009'),'d')-trunc(to_date('01-NOV-2009'),'Y')) )/7) as Sat from dual;
SELECT ceil(( 7+(trunc(to_date('02-NOV-2009'),'d')-trunc(to_date('02-NOV-2009'),'Y')) )/7) as Sun from dual;
SELECT ceil(( 7+(trunc(to_date('03-NOV-2009'),'d')-trunc(to_date('03-NOV-2009'),'Y')) )/7) as Mon from dual;
SELECT ceil(( 7+(trunc(to_date('04-NOV-2009'),'d')-trunc(to_date('04-NOV-2009'),'Y')) )/7) as Tue from dual;
SELECT ceil(( 7+(trunc(to_date('05-NOV-2009'),'d')-trunc(to_date('05-NOV-2009'),'Y')) )/7) as Wed from dual;
SELECT ceil(( 7+(trunc(to_date('06-NOV-2009'),'d')-trunc(to_date('06-NOV-2009'),'Y')) )/7) as Thu from dual;
Cheers!!!
Bhushan
Edited by: Buga on Oct 29, 2009 10:46 AM -
How to find out the infoProvider for a given dimension table?
Experts:
In RSA1, I want to find out the infoProvider for a given dimension table.
But I am not sure how to display the tables linked to a given infoProvider.
Could you provide a way to display all tables linked to a given infoProvider?
Thanks a lot!See, The dimension table starts with Dcubename1 and incremental Dcubename2 .... so on
Ex.ZSD_C01 is your cube name
Dim tables starts for this is /BIC/DZSD_C011 /BIC/DZSD_C012 ...
Goto - LISTSCHEMA - derive cube name from given dim table and enter cube name - execute - will show you all the tables -
Is it possible to find the Equipment for given PP work center?
Hello PM Masters,
Is it possible to find the Equipment for given PP work center?
Please tell me which table will lend me the EQUNR when I have the PP work center (ARBPL).
Thank you.Yes,
Provided you maintain this value in Equipment master Location tab like this.
And then query by this field in IH08
Jogeswara Rao K -
Our exchange server crashed and we lost all contact and calendar data. We found an app to get the contacts off of people's phone to import but can't find the same for calendar. How do I get my calendar info off my phone and in to new exchange server?
You'd have to think through this, but it seems like if you are using Outlook, and the items vanished from the Outlook client as well as the server,that you could re-populate Outlook using iTunes.
-
How to get the week number for a given date?
hi guys,
what is coding to get the week number for a given date?
For example, 1/1/05 is week 1. then 8/1/05 is week 2.The second parameter to pass to the method is supposed to be one of the month constants JANUARY - DECEMBER. It happens to be that their numerical values are 0-11, not 1-12, so your "12" refers to the "13th" month of the year.
givenDate = new GregorianCalendar(2003, Calendar.DECEMBER, 31);
If you want to construct dates and times from strings like you seem to be, look into SimpleDateFormat http://javaalmanac.com/egs/java.text/ParseTime.html
(even still I got WEEK_OF_YEAR as 1 which is true but not really what I expected, excuse my previous reply but I wanted to check the facts before posting this)
Maybe you are looking for
-
Quicktime codec for fcp files?
is there a way to view newer fcp files with out purchasing fcp? any iMovie plugins or quicktime or quicktime pro codecs available? I have fcp 6.0.6 on an old G5 dual processor runing Tiger 10.4.11, but now have a new MacBook Pro but not newest fcp an
-
Image capture has been recommended in this forum for downloading videos from my Digital camera. Alas, it´s not there! I have installed Mac OS X 10.4.5. Can anyone help?
-
How can I edit a table in my iPhone?, How can I edit a table in my iPhone?
I've set up a table in a pages document on my MacBook Air. I've shared the document to iCloud. I open the document in Pages on my iPhone, but can't edit any cell in the table. I can select a cell but my only option is to paste. The iPhones keyboar
-
Replace between [ and ]
Hi can someone give me a simple example of how to replace all characrters between '[' and ']' with one hardcoded string , eg schema name. I know how to do it with instr but looing for something straightforward with reg exp probably Edited by: Keith J
-
Photoshop cs6 scratch disks/won't open ps.
Okay, so I got the 'scratch disks are full' message when I tried opening new projects. After googling, I read to just change the location to another hard drive instead of the main one, so I went into preferences, unchecked the C drive & checked the E