Getting the Sunday dates using Next_Day
The requirement is:
Get the Sunday of this week and Sunday of the last week. As system date is 02-July, this Sunday is 01-July and last week Sunday is 24-Jun. If say suppose the system date is 01-July, then this Sunday should be 24-Jun and last Sunday should be 17-Jun. I tried something like :
Select
Next_Day(sysdate-8,'SUNDAY') sunday,
Next_Day(sysdate,'SUNDAY') End_Sunday,
To_Char(Next_Day(sysdate-8,'SUNDAY'),'YYYYMMDD') sun_mm,
1 Fl
From
Dual
Union
Select
Next_Day(sysdate-16,'SUNDAY') sunday,
Next_Day(sysdate-16,'SUNDAY')+7 End_Sunday,
To_Char(Next_Day(sysdate-16,'SUNDAY'),'YYYYMMDD') sun_mm,
2 Fl
From
Dual
I know the above doesn't work due to -16. Need some help in meeting the requirement.
Thanks
Chaitanya.S.S.K
Micheals,
this?
SQL> alter session set nls_territory=germany;
Session altered.
SQL> WITH t AS ( SELECT SYSDATE AS DT FROM dual
2 UNION ALL
3 SELECT TO_DATE('07/01/2007','MM/DD/YYYY') FROM dual
4 UNION ALL
5 SELECT TO_DATE('07/02/2007','MM/DD/YYYY') FROM dual
6 UNION ALL
7 SELECT TO_DATE('06/30/2007','MM/DD/YYYY') FROM dual)
8 SELECT DT, CASE WHEN TO_CHAR(DT,'DY')='SUN' THEN
9 TRUNC(dt,'d')-7
10 ELSE
11 TRUNC(dt,'d')
12 END last_sunday
13 FROM t;
DT LAST_SUN
03.07.07 02.07.07
01.07.07 18.06.07
02.07.07 02.07.07
30.06.07 25.06.07
SQL> alter session set nls_territory=america;
Session altered.
SQL> WITH t AS ( SELECT SYSDATE AS DT FROM dual
2 UNION ALL
3 SELECT TO_DATE('07/01/2007','MM/DD/YYYY') FROM dual
4 UNION ALL
5 SELECT TO_DATE('07/02/2007','MM/DD/YYYY') FROM dual
6 UNION ALL
7 SELECT TO_DATE('06/30/2007','MM/DD/YYYY') FROM dual)
8 SELECT DT, CASE WHEN TO_CHAR(DT,'DY')='SUN' THEN
9 TRUNC(dt,'d')-7
10 ELSE
11 TRUNC(dt,'d')
12 END last_sunday
13 FROM t;
DT LAST_SUND
03-JUL-07 01-JUL-07
01-JUL-07 24-JUN-07
02-JUL-07 01-JUL-07
30-JUN-07 24-JUN-07
Similar Messages
-
How to get the context data using java script in interactive forms
Hi All,
How to get the context data using java script in interactive forms by adobe, am using web dynpro java
thanks.Hi venkat,
Please Refer this link.
Populating one Drop-Down list from the selection of another Drop-down list
Thanks,
Raju. -
How to get the current date using HTMLB JSP page
Hi All, I developed an iview with several fields using PDK, I would like to know how can I include for a date field a dynamic value witch in this case is the current date.
<hbj:inputField
id="Date"
type="date"
maxlength="10"
showHelp="TRUE"
required="TRUE"
value="???"
/>
Thanks in advance
AlexisHi Alexis ,
u can use the setDate("3.12.2003") function to set date for this input field.
u just change the id = Date , because in jave we have Date class. rename it to another name..
suppose id = systemDate
<%
Format formater = new SimpleDateFormat("dd.MM.yyyy");
Date syDatum = new Date();
%>
then
put
systemDate.setDate(formater.format(syDatum));
this will set the date .....
Regards
Kishor Gopinathan -
How can I get the start date and end date of a certain week?
Hello, in my java code, I can get the week ID , using
org.joda.time.base.AbstractDateTime.getWeekOfWeekyear() , for example, this week is the 16th week of this year. And I want to get the start date(date of Monday) and end date(date of Sunday) of the week. Is there any method can supply such date value??thanks1 public Date getCurrentMonday(){
2 Date monday = null;
3 Calendar rightNow = Calendar.getInstance();
4 int day = rightNow.get(Calendar.DAY_OF_WEEK);
5 int distance = 0;
6
7
8 if (day == Calendar.MONDAY)
9 monday = rightNow.getTime();
10 else
11 {
12 distance = day - Calendar.MONDAY;
13 if (distance == -1)
14 distance = 6;
15
16 monday = (Date) (rightNow.getTime());
17 monday.setTime(monday.getTime() - 1000 *60 *60 *24 *(distance));
18 }
19 return monday;
20 } -
Not able to get the Qualification data from BAPI
Hi all,
I am using a BAPI (BAPI_JOBREQUIRE_GETLIST) to get the qualifiaction data for requirement profile. It's working fine earlier but I did not get the qualification data from this BAPI, although the data is there in DB against this requirement profile.
Can someone suggest me why I am getting this issue. I have looked into SDN and in BAPI documentation and found as below:
"You require authorization (structural authorization) to read the Requirements subprofile."
I am having the same User ID as I had before (when I getting back the correct data), so I don't think it should be authorization issue.
Can someone help me out in this issue please.
Thanks,
Sanket SethiHi Shiva,
It does not going to these includes at all. Message comes out with successfully done. The BApi is calling RHPP_COMMON_QUALI_READ inside, but this will not return any data. But if will call any qualification object ID, this BAPI will come up with data.
So the QP type LO profile will not come up with any kind of data, but if we pass the OTYPE as Q and pass any Qualification object ID then the data will be returned.
Is there any relationship or some other thing is missing? Any idea.
Thanks,
Sanket Sethi -
How can i get the meta data from database?
Hi, all java and db experts,
I need to write a tool to generate java file which will be used to hold the resultset of a stored procedure of Oracle. Is there any API call or tools to connect to db and then get the meta data of the return cursor instead of reading stored procedure definition on my own?
Please help, thanks a lot.
Hannaif i execute a Oracle stored procedure, the resultset of a cursor is returned. It's easy to know the meta data at the runtime.
However, could i get the meta data about the resultset of a cursor before runtime? Such as by connecting to the database and ask it about meta data of a specified stored procedure?
Is it feasible?
DatabaseMetaData dbmd = conn.getMetaData();
ResultSet rs = dbmd.getProcedureColumns("", "%", "SP_NAME", "%");
while (rs.next()) {
String colName = rs.getString(4);
int colType = rs.getInt(5);
int colDataType = rs.getInt(6);
int colPrecision = rs.getInt(8);
int colLen = rs.getInt(9);
int colScale = rs.getInt(10);
long defaultValue = rs.getLong(11);
But what i get is a list of stored procedure parameters. In oracle, cursor is IN OUT parameter . How can i get the meta data about the resultset of cursor? -
How can I get the image data from Clipboard with LV
Anybody knows How can get the image data after pressd "print screen button" with LV?
I want to program a software which can save a image as a bmp or jpeg etc, and the image data is from pressed print screen button.
How to get it out from clipboard. I am trapping about. thanks in advance.
Try to make everything AutomaticYou can have a look at Rolf Kalbermatter's post here (give him stars) or, if you're using scripting, you can use the Application class Get Clipboard Image method.
Try to take over the world! -
How to get the actual data in ALV report
I am doing some upgradation work in that i am using Submit & And return and also i am using some function modules like LIST FROM MEMORY , LIST TO TXT wnd WRITE LIST , it gives output in normal list format , But i need to print in ALV report .
With the use of set table for 1st display i got the ALV report but not with actual data, (some junk value is showing) , So can any 1 suggest me how to get the actual data in ALV report, With the use of Any Function Module or with Coding,
with regards,Hi Saravana
I am sure you must be getting the values in tables of table parameters from every FM.
consolidate the values from tables of all FMs in one table and built ALV for that table only.
I hope this way you can show the actual data in ALV.
thanks
Lalit -
How to get the Delivery date in PO line Item in SAPScript
Hi Gurus,
I am working on PO Script (MEDRUCK). I copied the Standard to a Z form. ZMM_MEDRUCK, Now I need to print the the Header text at the end of MAIN window. I put Iem number along with the other line Item informmation like stanadrd PO Script MEDRUCK. I also want to show the delivey date with line Item, so Itried to use EKET-EINDT but it is returning the delivery date of last line item, means while printing the first line and other information it is showing the delivery date of the last line item, I tried with the PEKPO-EINDT it is also not working.
Can any body suggest me how i can get the delivery date for the respective line Item ?
Regards
Sonyactually your are picking up the correct data from Table EKET (EKET-EINDT) but your are printing that in item data loop for EKET might have already executed in your script and the header of that internal table consist the last entry of the table so for that. Fetch the delivery date explicite from the Table EKET when your in item level processing and print that.
For Example u can use this code.
To print you have write the this code in Script item level printing window "MAIN" window
Following perform is called to get the line item delivery date in PO
{/: PERFORM GET_DEL_DATE IN PROGRAM ZPerform_prog
/: USING &EKPO-EBELN&
/: USING &EKPO-EBELP&
/: CHANGING &DEL_DATE&
/: ENDPERFORM}
{* Dellivery date &DEL_DATE& }
write the below code in the Z program "ZPerform_prog"
{ FORM get_del_date TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
READ TABLE in_par WITH KEY 'EKPO-EBELN'.
CHECK sy-subrc = 0.
$_po_no = in_par-value.
READ TABLE in_par WITH KEY 'EKPO-EBELP'.
CHECK sy-subrc = 0.
$_po_line = in_par-value.
SELECT *
FROM eket UP TO 1 ROWS WHERE ebeln EQ $_po_no AND ebelp EQ $_po_line.
$_del_date = eket-eindt.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = eket-eindt
IMPORTING
date_external = $_del_date
EXCEPTIONS
date_internal_is_invalid = 1
OTHERS = 2.
READ TABLE out_par WITH KEY 'DEL_DATE'.
CHECK sy-subrc EQ 0.
out_par-value = $_del_date.
MODIFY out_par
INDEX sy-tabix.
CLEAR : $_po_no , $_po_line ,$_del_date.
ENDSELECT.
ENDFORM. "GET_DEL_DATE } -
How to get the "current date" in the BEx?
Hi all,
I need to get the "current date" in my Bex report in order to make a comparison. I know there is a "How to" which shows how to get the current date via a User Exit, but I didn't find it. Could you please help me?
Thanks1. Create a New Formula in Key Figures structure
2. Give tech name and description and Select "New variable" option
3. Next screen will launch Variable Wizard -> create a new variable with replacement path as processing type
4. in next screene select the date characteristic that represents the first date to use in the calculation (From Date)
5. In the next screen select Key in the Replace Variable with field. Leave all the other options as they are
6. In the next Currencies and Units screen select Date as the Dimension ID.
6. Save variable
repeate the Above steps to create another variable (To Date)
and now you can use these two new replacement path variables in your new formula.
Dev -
How to get the current date and compare dates
hi
does anyone know how you would get the current date?
furthermore, how to compare the current date with a past date to see how many days or months have past since then?
thankshave a look at the Date class. new Date() creates an object containing the exact date and time at creation time. (Date).getTime() might be useful for comparing two dates. GregorianCalendar might be useful, too.
-
Date fields and compare and get the later date of the fields
I am trying to compare these date fields and compare and get the later date of the fields
Tables are
TABCASER
TABCASER1
EVCASERS
Field
Are
TABCASER1.CASER_no
The dates are to be compared and then get the records with the highest or latest date value.
TABCASER1.CASERRECIEVEDDATE
EVCASERS.FINALEVDATES
EVCASERS.PUBLICATIONDATE
EVCASERS.PUBLICATIONDATE
TABCASER.COMPAREACCEPDATE
I have this code but I am trying to figure out what it all means.
I have several questions.
1.
1. greatest it is used here to compare right? How do I then output this ? do I store it to a var (coldfusion) ultimately , I wish to send it to a page of records
2. is it necessary to use todate? And to_date? What does this do?
3. decode, is this necessary too. What does this do? NULL?
4.
5.
6. when I do get the query results how do I send it to coldsuion and out put to a display.
Someone sent me this code.
is there abetter way of doing this? To compare the dates and store in a var to display. thanks
Here is my code below:
Greatest(
CASE
WHEN INSTR(TABCASER1.CASER_no,'-CE') > 0 THEN
decode(TABCASER1.CASERRECIEVEDDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),TABCASER1.CASERRECIEVEDDATE)
WHEN INSTR(TABCASER1.CASER_no,'-ERNIE') > 0 THEN
decode(EVCASERS.FINALEVDATES,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),EVCASERS.FINALEVDATES)
WHEN INSTR(TABCASER1.CASER_no,'-MONIE') > 0 THEN
decode(EVCASERS.PUBLICATIONDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),EVCASERS.PUBLICATIONDATE)
WHEN INSTR(TABCASER1.CASER_no,'-NADINE') > 0 THEN
decode(EVCASERS.PUBLICATIONDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),EVCASERS.PUBLICATIONDATE)
ELSE
decode(TABCASER.COMPAREACCEPDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),TABCASER.COMPAREACCEPDATE)
END
,decode(TABCASER.COMPAREACCEPDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),TABCASER.COMPAREACCEPDATE))
between TO_DATE('#dateformat(form.startDate,"mm/dd/yyyy")#','MM/DD/YYYY') and TO_DATE('#dateformat(form.endDate,"mm/dd/yyyy")#','MM/DD/YYYY')
is there abetter way of doing this? To compare the dates and store in a var to display. thanksHi
If you have date datatypes than:
select
greatest(TABCASER1.CASERRECIEVEDDATE, EVCASERS.FINALEVDATES, EVCASERS.PUBLICATIONDATE, EVCASERS.PUBLICATIONDATE, TABCASER.COMPAREACCEPDATE)
from TABCASER, TABCASER1, EVCASERS
where ...-- join and other conditions
1. greatest is good enough
2. to_date creates date dataype from string with the format of format string ('mm/dd/yyyy')
3. decode(a, b, c, d) is a function: if a = b than return c else d. NULL means that there is no data in the cell of the table.
6. to format the date for display use to_char function with format modell as in the to_date function.
Ott Karesz
http://www.trendo-kft.hu -
How to get the client date and time ?
Dear Sirs...
Using jdeveloper 10.1.2.0
How can i get the client date and time using the HttpServletRequest ?
thanks for any help in advance
best regardsIf your code is running on the client pc you can just create a new instance of the java.util.Date class. That class automatically defaults to the current time of the client machine. Otherwise if you're running the code on the server, you could insert/post the client date/time by adding its string representation as a parameter to the HTTP request object.
Ronald -
How can I get the system date in mm/dd/yyyy,
how can I get the system date in mm/dd/yyyy, i need to compare system date with some other date,continuosly using threads,can U plz help me.
With Some code
Thanks In advnace
MahiiiiHi,
You can use SimpleDateFormat class under java.text package.
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy h:mm a z", new Locale());
//formatter.setTimeZone(timezone);
String dateTime = formatter.format(new Date()); -
How to get the pixel data so as to work on it?
Hi all,
I am trying to write a plug-in that will crop and scale the image, edit the selection in the image document based on image data. For this purpose I need the pixel data of the image. How to get the image data as different pixels and what is the data structure used to store this data?
Assumption: No layers i.e., only background
Thanks in advance,
SailuHi Ilya,
Thank you for your post. In the plugin architecture you propose (automation + filter), do you have an idea about how to share the pixel data between the two plugins? I have found a post that gives details about how to get pixel data and show it using ADM components
Matthew Hollingworth, "ADM Color Managed Preview?" #1, 22 Oct 2007 11:53 pm but it supposes that you have a filter plug-in.
Again, does anyone knows how to preview the current image in a AUTOMATION plug in? This seems impossible.
Thank you all for your help
Cheers,
Chaker
Maybe you are looking for
-
"No Wi-Fi" - Grayed Out in Settings - iPhone 3G
I realize similar topics have been discussed, but I can't pinpoint this to a specific OS update- it's my wife's iPhone, and she didn't even realize it had stopped working. The option is grayed out in the settings, and no combination of resetting the
-
Issues on Upgrade 9 2 0 6 to 11 1 0 7
Team I am trying to update my 9.2.0.6 database (in 11.5.10.2 apps environment) to 11.1.0.7. ( only database upgrade, later i want to upgrade apps to 12.1.3) on Linux 4.0 I have done the following steps. Installed 11.1.0.6 software on separate home an
-
hi there i meet a requirement about alv display. i have some data like below bukrs name1 ort01 prctr budat pswsl wrbtr 9999 A01 01 99990000 20070601 HKD 0 9999 A01 01 99990000 20070601 SGD -1870.84 9999 A01 01 99990000
-
How do I do this... rollover effect.
Hi, I have been doing some layout in Photoshop for a basic website. I have one .jpg which will be my background. I have created some thumbnails (filmstrip area), and I want them to highlight as the mouse goes over them. At the same time I want the
-
Altenate work centers in production order
Hi, we have 2 different work cneters and any one work center can be selected in the prod order when we process. please advise how to create a routing that will allow to enter 2 work centers for one operation (alternate to each other) so that when we