Need function to find date of a day
Hi,
Please advice a query or a function that will get me all the dates of the current year that fall on friday.
Ex: If the query is run the desired output as below
02/01/2009
09/01/2009
16/01/2009
Thank You
This will work, although it is nls dependent:
select next_day(trunc(sysdate, 'yyyy')-1, 'FRI') + 7*(level-1) friday_dates
from dual
where trunc(next_day(trunc(sysdate, 'yyyy')-1, 'FRI') + 7*(level-1), 'yyyy') = trunc(sysdate, 'yyyy')
connect by level <= 53;
FRIDAY_DAT
02/01/2009
09/01/2009
16/01/2009
04/12/2009
11/12/2009
18/12/2009
25/12/2009
Similar Messages
-
Need function modules for date manupulation
HI,
Could you please suggest the function module the below reqiurments
1) adding days to date.
ex: 20 days to 25.03.2008 = 15.04.2008
2) To find the given date is working date or not according to factory calender id.
3) To find the previous or last working date to the given date(Holiday date) according to the factory calender id.
It is very urgent requirment. please help me.
Thanks in advance
sathish kumar swamyhi use this...
RE_ADD_MONTH_TO_DATE
DATE_CONVERT_TO_FACTORYDATE
CALL FUNCTION 'OIL_LAST_DAY_OF_PREVIOUS_MONTH'
EXPORTING
I_DATE_OLD = date1
IMPORTING
E_DATE_NEW = date1
data date2 like sy-datum.
date2 = date1 + 1.
write date2.
If you put 27.12.2005 as the input date, date2 you will get as 01.12.2005.
Or else you can use the following code:
v_startdate = sy-datum.
v_startdate+6(2) = '01'.
v_enddate = v_startdate.
if v_enddate+4(2) >= '01' AND v_enddate >= '11'.
v_endate4(2) = v_enddate4(2) + 1.
elseif v_enddate = '12'.
v_enddate+4(2) = '01'.
v_enddate(4) = v_enddate(4) + 1.
endif.
v_enddate = v_enddate - 1.
regards,
venkat. -
Any Date function to find date on last friday?
Hi all,
Is there any date function module to find out the date on last friday....
And one more thing....any function module to findout the range of dates for the last week...(i.e) date from last week monday to last week friday.
Thanking u all in advance.
Regards,
Chandra SekharREPORT ZSN_FRIDAYTEST .
data: days type p.
data: date type sy-datum.
parameters: p_date like sy-datum default sy-datum.
*-- Get the last Friday
call function 'DAY_IN_WEEK'
exporting
datum = p_date
IMPORTING
WOTNR = days.
days = days + 2.
date = p_date - days.
write:/ '(Assuming Monday is the first day of the week)'.
write:/ 'Date Entered:', p_date.
write:/ 'Last Friday:', date.
*- Range of dates in last week
data: date1 type sy-datum.
data: date2 type sy-datum.
data: days1 type p.
data: days2 type p.
call function 'BWSO_DATE_GET_FIRST_WEEKDAY'
exporting
date_in = p_date
IMPORTING
DATE_OUT = date1
date1 = date1 - 7.
date2 = date1 + 4.
write:/ 'Range:', date1, '-', date2. -
Need function to find 1st friday on every quarter
Hi,
need a function or a query to find the 1st friday on every quarter of the current year, any help is appreciated.
Thank YouHi,
like this ??
SQL> select dt
2 from ( select to_date(decode('&quarter', '1', '01-01-2008',
3 '2', '01-04-2008',
4 '3', '01-07-2008',
5 '4', '01-10-2008'), 'dd-mm-yyyy')
6 + level - 1 dt
7 from dual
8 connect by level <= 7)
9 where trim(to_char(dt, 'DAY')) = 'FRIDAY';
Enter value for quarter: 1
old 2: from ( select to_date(decode('&quarter', '1', '01-01-2008',
new 2: from ( select to_date(decode('1', '1', '01-01-2008',
DT
04-JAN-08
SQL> /
Enter value for quarter: 2
old 2: from ( select to_date(decode('&quarter', '1', '01-01-2008',
new 2: from ( select to_date(decode('2', '1', '01-01-2008',
DT
04-APR-08
SQL> /
Enter value for quarter: 3
old 2: from ( select to_date(decode('&quarter', '1', '01-01-2008',
new 2: from ( select to_date(decode('3', '1', '01-01-2008',
DT
04-JUL-08
SQL> /
Enter value for quarter: 4
old 2: from ( select to_date(decode('&quarter', '1', '01-01-2008',
new 2: from ( select to_date(decode('4', '1', '01-01-2008',
DT
03-OCT-08
SQL> SELECT NEXT_DAY(TRUNC(TO_DATE(SYSDATE,'DD-MON-YYYY'), 'Q')-1,'Friday') FROM dual;
NEXT_DAY(
05-OCT-08
SQL>You may as well pass Year if you want by converting it to a bind variable.
Regards
Asif Momen.
http://momendba.blogspot.com -
Function module find date Range input for scheduling a job
hi i have created a program for scheduling a back ground job for purchase order extract in that i have to get the last 7 days records when i schedule it on every sunday can any one tell me the function module which satisfies the requirment
Date Range input in my program to be calculated for past 7 days from current date (ie from Sunday to Saturday of the week.)Hi,
You can do it simply by
v_cdate TYPE sy-datum, " current system date
v_cdate = sy-datum - 7. " take date 7 days before current date
Pass this v_cdate in your logic
Hope it will help you.
Thanks
Arun Kayal -
Hi all
I just developed a registration application using netbeans 6, glassfish and mysql, JSF EJB
The program runs perfectly apart from a little instability from netbeans. But after the success page has displayed, i Cannot find the data I persisted in the database.
Can some one help me since i'm a bit new to this.
Thanks in advanceSorry but my problem is that after the persistence, i could not find the data I entered in the JSF register page.
The progran first displays a register page:
after validation the backing bean invokes the session bean method to save the data.
The method returns a string which is then used in faces config to display the login page.
Well when I run the program, everything works fine.
then i enter the select command in the mysql server console to view the data but the new entry could not be found in the database
Is it that the program is faulty or the data was not saved since there was no exception or error dispalyed -
My MBA was stolen. I need to buy a replacement the next day bec I used it for work. I downloaded the Find iPhone apps and registered my stolen MBA. If I will erase MAC will it also erase the data of my new MBA?
did you turn 'find my mac' ON your MBA BEFORE your it was stolen? if not, you will not be able to do anything to the stolen MBA
if you did turn it on before it was stolen, yes it will erase everything on the MBA -
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. -
Function, procedure to find next "x" business days
Hi,
Is there any function procedure to find next 10 business days in oracle.
Also i have a local holiday table which are non-working days.
Thanks.Hi,
Ramin showed how to get the next 10 days.
If you want to exclude holidays and weekends, and get only the 10th day, then you can do something like this:
WITH next_hundred_days AS
SELECT TRUNC (SYSDATE) + LEVEL AS bnsdate
FROM dual
CONNECT BY LEVEL <= 100
, work_days AS
SELECT n.bnsdate
, ROW_NUMBER () OVER (ORDER BY bnsdate) AS day_num
FROM next_hundred_days n
LEFT OUTER JOIN holidays h ON h.dt = n.bnsdate
WHERE TO_CHAR ( bnsdate
, 'Dy'
, 'NLS_DATE_LANGUAGE=ENGLISH'
) NOT IN ('SAT', 'SUN')
AND h.dt IS NULL
SELECT bnsdate
FROM work_days
WHERE day_num = 10
;This assumes that there will be at least 10 work days in the next 100 days. Where I work, that's a very safe assumption.
I hope this answers your question.
If not, post CREATE TABLE and INSERT statements for a few rows from your holiday table.
Post a few (starting date, number of days) pairs, and the results that you would want from each pair, given the data you posted in the holiday table.
See the forum FAQ {message:id=9360002} -
Function Module to find date by passign the Planning Calendar
Hi All,
Can you tell me is there any function Module to find date by passign the Planning Calendar?
The requirement is i have a planning calender assigned to the Material in the MRP2 view.
Example: Material XXXXXX is assigned a Planning Calendar Z01.
Z01 is defined such that Delivery is on Monday only. This calendar says that the material is received from the Vendor only on Mondays.
So whenever i punch a Sales Order for Material XXXXXX, a PR is automatically geenrated when saving the sales order and the calculation of Delivery dates is also happening at this level.
Basing on this PR a PO is raised to a Vendor for procuring the Material XXXXXX, now my problem is for example the PO is raised today (30.04.2008), but the Materail XXXXXX is available only on next monday in my plant (05.05.2008) basing on my Planning Calendar assigned in the Materail Master, so i have to inform this dealy to my customer at the time of punching the sales order.
So is there any function Module to find date by passign the Planning Calendar?
Thanks for your valuable inputs.
Regards,
SudarshanHi Jorge,
Thanks for your reply.
I am unable to open the Function module which you have mentioned below.
I am working on 4.6 c version of SAP.
Any ways i have found one function module which is useful to my requirement as stated below:
DATE_GET_PERIOD
Thanks and Regards,
Sudarshan -
Need to buy Apple Care within 60 days of purchase date?
Since when you need to buy Apple Care within 60 days of purchase date? I thought you can do it before the end of one-year limited warranty, no?
shotarobkk wrote:
Wrong. I don't think so that it was like that since forever like you said. It used to be that you can buy the Apple Care before the end of one-year limited warranty. It's changed as well for iPad, but stay the same for iMac and the monitors.
No, sorry, but AppleCare+ has always been a limited purchase option. You may be confusing extending AppleCare, which only covered technical support for an additional year, but since AppleCare+ covers replacements now, when it was first introduced, it started with a 60 day buy it or not be able to buy it option. -
Function Modules on date and day.
I need to calculate the date of the following Sunday based upon the current date.Could you suggest how to go calculate the same and if there are any function modules to do the same.
HI sandeep this will give u the best results....
parameters:
p_date like sy-datum ." here u give the required date
data:
w_date1 type i,
w_mod type i.
w_date1 = p_date.
* write: / p_date1.
w_mod = w_date1 mod 7.
write: / w_mod.
if w_mod ne 0.
w_date1 = w_date1 + ( 7 - w_mod + 1 ).
else.
w_date1 = w_date1 + 1.
endif.
move w_date1 to p_date.
write: / 'the following sunday is ',p_date.
I hope it will helps u..
if helps reward with points..
Regards Rk..
null -
Oracle sql function to find VARCHAR2 data is numeric
Hi Everyone,
Is there oracle sql function to find whether the VARCHAR2 data is numeric?
Thankshi,
see the below example .
with t as
(select '12' as col from dual union all
select '1 2' as col from dual union all
select '2 1 3' as col from dual union all
select 'abcde' as col from dual union all
select '12345' as col from dual union all
select '1a4A5' as col from dual union all
select '12a45' as col from dual union all
select '12aBC' as col from dual union all
select '12abc' as col from dual union all
select '12ab5' as col from dual union all
select '12aa5' as col from dual union all
select '12AB5' as col from dual union all
select 'ABCDE' as col from dual union all
select '123-5' as col from dual union all
select '12.45' as col from dual union all
select '1a4b5' as col from dual union all
select '1 3 5' as col from dual union all
select '1 45' as col from dual union all
select '1 5' as col from dual union all
select 'a b c d' as col from dual union all
select 'a b c d e' as col from dual union all
select 'a e' as col from dual union all
select 'Steven' as col from dual union all
select 'Stephen' as col from dual union all
select '111.222.3333' as col from dual union all
select '222.333.4444' as col from dual union all
select '333.444.5555' as col from dual union all
select 'abcdefabcdefabcxyz' as col from dual union all
select 'aaa' as col from dual union all
select 'ddd' as col from dual union all
select 'ccc' as col from dual union all
select 'aaaaa' as col from dual union all
select 'aaaaaaaa' as col from dual
select * from t where regexp_like(col,'[1-9]')
Result
COL
12
1 2
2 1 3
12345
1a4A5
12a45
12aBC
12abc
12ab5
12aa5
12AB5
123-5
12.45
1a4b5
1 3 5
1 45
1 5
111.222.3333
222.333.4444
333.444.5555Thanks,
P Prakash -
Hi, i want to find the difference in days of two students Date Of Birth
hi, i want to find the difference in days of two students Date Of Births
how can i find.
please help mei didn't find what u saidLet me help you:
http://onesearch.sun.com/search/onesearch/index.jsp?qt=difference+between+dates&subCat=siteforumid%3Ajava54&site=dev&dftab=siteforumid%3Ajava54&chooseCat=javaall&col=developer-forums -
Function, procedure to find next 10 business days
Hi,
Is there any function procedure to find next 10 business days in oracle.
Also i have a local holiday table which are non-working days.
Thanks.user7987260 wrote:
Hi,
Is there any function procedure to find next 10 business days in oracle.
Also i have a local holiday table which are non-working days.
Thanks.Welcome to OTN!
This forum is for PL/SQL Developer questions. SQL and PL/SQL questions have their own forum that you can find under the Oracle Database heading. You should get a better answer if you ask your question there
Maybe you are looking for
-
Dynamic Link... My Question Disappeared?
I tried to import a video to Photoshop CS6 Extended, in order to export it as an animated gif. I posted a question about it here, it appeared in 'trending' and then disappeared ! Did a moderator move it? My question was... when I tried to import I go
-
Group and channelname in legend
To have the channelname in the legend is easy I just add @CN(#)@ but is it possible to have the groupname aswell?? Solved! Go to Solution.
-
Problems with connection with Oracle Database (Dreamweaver)
I'm trying to create a connection with a oracle database, with JDBC. In order to do that, I've downloaded the classes12.zip driver in my machine. This is the driver from Oracle. I've put this file into directory c:\Program Files\Macromedia\Dreamweave
-
How to Post Customer Return in Materials Management ?
Dear Experts, I want to know the cycle of excisable customer return material. How the Goods receipt will be posted with excise duties and further processing in materials management. Also please mention the integration points with Sales and destributi
-
Reds turned to rust in CS 5, Reds are accurate in Windows. How can I correct this.