How to get week starting with sunday date
Hi
I have a date column "start_date", i need to create a report for all the weeks starting from sunday , for eg:
i need to get week dates as :
mm/dd/yy - 01/23/11 , 01/16/11 , 01/09/11 and so on...
Please help
Thanks...
Hi,
To find the last Sunday before or equal to start_date:
SELECT TRUNC ( start_date + 1
, 'IW'
) - 1 AS week_start_date
...You can use an expression like this in a GROUP BY clause, also.
This does not depend on you NLS settings. ISO weeks always start on Monday. Your week starts 1 day earlier, so that's why the expression above has the +1 and -1.
(Depending on you NLS settings,
SELECT TRUNC ( start_date
, 'D'
) AS week_start_date
...might do the same thing, but I still rocommend using 'IW'; a few extra keystrokes isn;t much to pay for a guarantee that it will always work.)
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
Similar Messages
-
How to get the start time and date
Hi everyone! I have a question ,who will be glad to help me! Thanks in advance!
As we know ,when we finish the UUT test ,it generate report . The report format maybe like"SeqFileName_Report[Time][Date]_00001.xml"
My question is"how can I get the [Time] and [Date] in the test sequence"See this post.
How To Display Time Information in Report/Results?
http://forums.ni.com/t5/NI-TestStand/During-a-test-how-can-I-find-the-start-time-and-date-of-that/td...
Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.
"You are what you don't automate"
Inplaceness is synonymous with insidiousness -
I'm currently coding a calendar where I want to diplay all
event for the current week.
Can anyone tell me how to get the dates to use in the query?
ThanksWhen I run this:
<cfscript>
Offset = (DayOfWeek(Now()) - 1) * -1;
Date1 = dateadd("d", offset, now());
Date2 = dateadd("d", 7, Date1);
</cfscript>
<cfdump var="#date1# and #date2#">
I get this:
{ts '2009-01-18 10:58:34'} and {ts '2009-01-25 10:58:34'}
Looks like I should have only added 6 days for date2, but
that's minor. How did you manage to get 2009-02-01? -
How to get week & quarter for entered date
I need help on below query
1) when i enter date, it should bring previous & further week of that month. As per my requirement my week starts from Saturday to Friday. Lets say that i am entering 24.01.2006, then it should bring week 1 from 7th Jan to 13th Jan 206, 14th Jan to 20th Jan 2006 & so on.
2) Similarly when i enter date as above , i want data coming on quarter basis instead of week..
I will be highly thankfull to you for the help..
Regards
[HASAN]HI
try HR_99S_GET_QUARTER.
type-pools: p99sg.
data: l_week type P99SG_QUARTER.
CALL FUNCTION 'HR_99S_GET_QUARTER'
EXPORTING
IM_DATE = sy-datum
IM_ABKRS =
IM_PERMO =
IMPORTING
EX_QUARTER = l_week.
EX_RETURNCODE =
write:/ l_week-begda.
write:/ l_week-endda.
Message was edited by: Harikishore Sreenivasulu -
Getting the start and end dates of the week
Hi,
I was stuck with a problem in getting the start date and end date of the week,i know the month ,week and year also,with these three values how can i get the start and end dates of a week.please help me
ThanksThere is no simple way. It has to be a math calculation.
There are several ways you can get the dates. First you have to know what day is January 1st and what day is december 31st for a particular year. Second you have to check whether the given year is a leap year or not. Based on the abvove information you should be able to find out what day is a particular date.
Hope this helps to get you started.
- Venkat Dhurjati. -
How to start with Master data management
Hi All,
I want to start with Master Data Management. Can any one provide me proper material to get the knowledge on Master Data Management Integration. And What is the relationship between XI.and for starting MDM what all settings i have to do???
Its really urget plz help me out.
Thanks,
Seema Khandelwal
Message was edited by:
Seema khandelwalHi ..
look at this documents
/people/andreas.seifried/blog/2007/08/30/how-to-use-the-test-environment-of-the-mdm-enrichment-controller
/people/harrison.holland5/blog/2006/11/27/mdm-syndication
/people/harrison.holland5/blog/2007/01/22/testing-and-monitoring-an-interface-between-mdm-xi
see this Wiki to find all the documentation on MDM:
https://wiki.sdn.sap.com/wiki/display/HOME/MasterDataManagement
Here, for the components you need to install:
https://wiki.sdn.sap.com/wiki/display/HOME/MasterDataManagement+Components
Others smart links are here:
- sdn e-learning.
https://www.sdn.sap.com/irj/sdn/mdm-elearning
http://service.sap.com/installMDM for a
you can use expression editor to do that:
have a look at this guide on how dates can be calculated there
with your field it can be very similar:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b025fab3-b3e9-2910-d999-a27b7a075a16
for more details about expression editor:
Calculation Fields chapter
https://websmp108.sap-ag.de/~sapidb/011000358700006291622006E
MDM 5.5 SP05 - ABAP API
https://websmp101.sap-ag.de/~sapidb/011000358700000271902007E
MDM 5.5 SP05 - ABAP API How To Guides (ZIP File)
https://websmp101.sap-ag.de/~sapidb/011000358700000271912007E
How to Identify Identical Master Data Records Using SAP MDM 5.5 ABAP APIs
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e060251e-b58d-2910-02a2-c9a1d60d9116 -
I am just starting out in graphic design and I wanted to know how to get more involved with either adobe and or graphic design? I am really very interested in working with adobe and graphic design more and becoming more involved with both!!
I have now recently downloaded 10.0.2 which is confusing in itself, as, as far as I can ascertain that is actually version 11, but I'm not even sure about that.
Version 10.0.2 is the newest version and the successor to GarageBand '11 (version 6.0.5).
The '11 is referring to the iLife '11 suit of multimedia application - the older GarageBand was a part of this bundle.
Have a look at Edgar's graphical enhanced manuals, the explain very detailed how things work and why. You can buy them as iBooks from the iBook store or directly from the page:
http://DingDingMusic.com/Manuals/ -
How to get sharepoint online (office 365) data in cloud/windows azure (provider) hosted app using Javascript?
I wish to retrieve sharepoint online data in html page (hosted in windows azure) using javascript and then need to play with AngularJSHi,
According to your description, you might want to get data from Office 365 SharePoint Online(also known as host web) and pass to the Provider Hosted App which is hosted
in Windows Azure site.
I would suggest you take a look at the links below about accessing data from the host web
for a quick start:
https://msdn.microsoft.com/en-us/library/office/fp179927(v=office.15).aspx#SP15Accessdatafromremoteapp_Codeexample
http://dannyjessee.com/blog/index.php/2014/07/accessing-sharepoint-data-from-provider-hosted-apps-use-the-right-context/
Aother sample solution for your reference:
https://code.msdn.microsoft.com/SharePoint-2013-Get-the-0ec36bb6
Best regards
Patrick Liang
TechNet Community Support -
How to get maximal value from the data/class for show in Map legend
I make WAD report that using Map Web Item.
I devide to four (4) classes for legend (Generate_Breaks).
I want to change default value for the class by javascript and for this,
I need to get maximal value from the class.
How to get maximal value from the data/class.
please give me solution for my problem.
Many Thx
Eddy Utomouse this to get the following End_date
<?following-sibling::../END_DATE?>
Try this
<?for-each:/ROOT/ROW?>
==================
Current StartDate <?START_DATE?>
Current End Date <?END_DATE?>
Next Start Date <?following-sibling::ROW/END_DATE?>
Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
================
<?end for-each?>
o/p
==================
Current StartDate 01-01-1980
Current End Date 01-01-1988
Next Start Date 01-01-1990
Previous End Date
================
==================
Current StartDate 01-01-1988
Current End Date 01-01-1990
Next Start Date 01-01-2005
Previous End Date 01-01-1988
================
==================
Current StartDate 01-01-2000
Current End Date 01-01-2005
Next Start Date
Previous End Date 01 -
How to select header group with detailed data in one SQL
Dear,
I would like to have a little help from you. My goal is to create a view where data must be in appropriate format. In this format i would like to have for each group one header.
I have 3 tables which they ar connected to each other (representing hierachical data where financial plan breaks across different groups).
CRM_PLAN
CRM_PLAN_ID
DATE
AMOUNT
CRM_PLAN_PE
CRM_PLAN_PE_ID
TITLE
AMOUNT
CRM_PLAN_ID (ref key to CRM_PLAN.CRM_PLAN_ID)
CRM_PLAN_MONTH
CRM_PLAN_MONTH_ID
YEAR
MONTH
AMOUNT
CRM_PLAN_PE_ID (foreign key to CRM_PLAN_PE.CRM_PLAN_PE_ID)
Data looks like:
CRM_PLAN
CRM_PLAN_ID | DATE | AMOUNT
1 | 01.01.2012 | 500
2 | 01.02.2012 | 200
CRM_PLAN_PE
CRM_PLAN_PE_ID |TITLE | AMOUNT | CRM_PLAN_ID
1 | Organization 1 |100 | 1
2 | Organization 2 |400 | 1
3 | Organization 3 |200 | 2
CRM_PLAN_MONTH
CRM_PLAN_MONTH_ID | YEAR | MONTH | AMOUNT | CRM_PLAN_PE_ID
1 | 2012| 1 | 60 |1
2 | 2012| 2 | 40 |1
3 | 2012| 1 | 350 |2
4 | 2012| 2 | 50 |2
5 | 2012| 1 | 200 |3
I would like view which would return data like:
MONTH | AMOUNT
Organization 1 |null
1 | 60
2 | 40
Organization 2 | null
1 | 350
2 | 50
Organization 3 | null
1 | 200
The main question is hot to write an sql as source for view to insert before each group a row with title column value from table CRM_PLAN_PE. Is that even possible? Maybe you could suggest me some other method.
View will be used in oracle form where will be possible to edit data - I will arrange that through insted of trigger.
Regards,
Igor
Edited by: user5528050 on 29.11.2012 2:23
Edited by: user5528050 on 29.11.2012 2:24
Edited by: user5528050 on 29.11.2012 2:25Hi, Igor,
user5528050 wrote:
... I would like view which would return data like:
MONTH | AMOUNT
Organization 1 |null
1 | 60
2 | 40
Organization 2 | null
1 | 350
2 | 50
Organization 3 | null
1 | 200
The main question is hot to write an sql as source for view to insert before each group a row with title column value from table CRM_PLAN_PE. Is that even possible? Maybe you could suggest me some other method. So, you want to have 2 different kinds of rows in the output:
(1) "parent" or "master" rows containing data from crm_plan_pe, such as
MONTH AMOUNT
============== ======
Organization 1(2) "child" or "detail" rows containing data from crm_plan_month, such as
MONTH AMOUNT
============== ======
1 60Sure, you can do that.
One way is to do a UNION of 2 separate queries: (1) to generate just the parent rows, (2) to generate just the child rows.
You could also join the 2 tables and use GROUP BY GROUPING SETS. The super-aggregate rows would be the parent rows.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved (it looks like crm_plan is not involved in this problem), and also post the results you want from that data. You need to post this whether or not you want SQL code in reply. The people who want to help you want to provide good answers, and that means they want to re-create the probelm and try their ideas.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
i have a problem with mail. the spelling and grammer check box before sending the messege is no longer there. I did everything but cannot get it back. is ther anyone who knows how to get the box with spelling and grammer checks before sending the mail.
Also the mail is acting very funny by not getting the rules work in a proper method. Is ther a software to repair mail.i did both of them, but still the while sending the mail the diolog box is not showing up and also the spelling and grammer does not do the spelling check.
This problem just started for about 3 to 4 days now. earlier it was working normally. -
How to get the difference of two dates in years,months and days
Hi friends,
how to get the difference of two dates in years,months and days
for ex 2 years 3 months 13 days
select (sysdate-date_Start) from per_periods_of_service
thanksSomething like this...
SQL> ed
Wrote file afiedt.buf
1 with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
2 select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
3 select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
4 )
5 -- end of test data
6 select c_start_date, c_end_date
7 ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
8 ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
9 ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
10* from t
SQL> /
C_START_D C_END_DAT YRS MNTHS DYS
17-NOV-06 21-JAN-08 1 2 4
21-NOV-06 17-FEB-08 1 2 27
21-JUN-06 17-JUL-08 2 0 26
SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too. -
How to get the name of a Data Element of a generic Table!
Hi guys!
In my function i have the following import paramenter
i_outtab type standard table
now i import a table and i want to get the dataelement of the fields.
is there a way to do this??Hello Thomas
Perhaps the following sample report may be useful for you.
*& Report ZUS_SDN_RTTI_STRUCT_COMPONENTS
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1145711"></a>
*& Thread: How to get the name of a Data Element of a generic Table!
REPORT zus_sdn_rtti_struct_components.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_s_outtab.
TYPES: bukrs TYPE bukrs.
TYPES: kunnr TYPE kunnr.
TYPES: END OF ty_s_outtab.
DATA: gdo_data TYPE REF TO data.
DATA: gs_outtab TYPE ty_s_outtab.
DATA: go_typedescr TYPE REF TO cl_abap_typedescr,
go_structdescr TYPE REF TO cl_abap_structdescr,
go_datadescr type ref to cl_abap_datadescr.
DATA: gs_comp TYPE abap_compdescr,
gd_dtel type string,
gt_dfies type ddfields.
FIELD-SYMBOLS:
<gs_struct> TYPE ANY.
START-OF-SELECTION.
BREAK-POINT.
GET REFERENCE OF gs_outtab INTO gdo_data.
ASSIGN gdo_data->* TO <gs_struct>.
go_typedescr = cl_abap_typedescr=>describe_by_data( <gs_struct> ).
go_structdescr ?= go_typedescr.
BREAK-POINT.
LOOP AT go_structdescr->components INTO gs_comp.
go_datadescr = GO_STRUCTDESCR->GET_COMPONENT_TYPE( gs_comp-name ).
gd_dtel = go_datadescr->get_relative_name( ).
write: / syst-tabix, 'Data element =', gd_dtel.
ENDLOOP.
END-OF-SELECTION.
Regards
Uwe -
How to get the today's julian date in java?
how to get the today's julian date in java?
hi can any one tell me how to get the todays julian date using Calender class or GregorianCalender class....
Julian date for 2006.November.01 AD 05:54 PM : 2454041.0
i have tryied with
calJ.setGregorianChange(new Date(Long.MAX_VALUE));
System.out.println(sdf2.format(calJ.getGregorianChange()));
thanks
Tushar
Message was edited by:
lad_tusharthanks a lot....for intrest....
I have found some details about the Julian calendar as follows:
The Julian date for 2006: JAN: 01:12:01:59 is 2453737.00138
245 represent the year digits for year 2006
3737 represent the date fir 1 Jan
.00138 represents the time for 12:01:59
Julian date change as per every day 12 noon it increase one digit in it.
As per ref from
http://www.aavso.org/observing/aids/jdcalendar.shtml
Also chk this calendar where Julian date is 20. October 2006 for 02 November 2006
As per ref from
http://www.calendar.sk/julian_calendar-en.php
I have tried the pure �GregorianCalendar� class from jdk1.4 API and its setGregorianChange method but not getting as per the expected Julian date format. Using the �setGregorianChange()� i have setting the cutover date to Long.MAX_VALUE it means GregorianCalendar now have to act as per the Julian calendar ...so after setting the cutover date it return me changed date using �getGregorianChange()� but that was not the Julian date of the current date...as expected or as per above both scenario. Even though the last two digits are nowhere equal to the actual Julian date.
Program
GregorianCalendar cal = new GregorianCalendar();
cal.setGregorianChange(new Date(Long.MAX_VALUE)); // setting the calendar to act as a pure Julian calendar.
// cal.set(Calendar.DATE, new Date().getDate()); // seting the current date
// Date todayJD = cal.getGregorianChange(); // getting the changed date after the setGregorianChange
Date todayJD = cal.getTime(); // getting the calculated time of today�s Julian date
SimpleDateFormat sdfJulianDate = new SimpleDateFormat("yyDDD");
SimpleDateFormat sdfJuliandayOfYear = new SimpleDateFormat("DDD");
System.out.println("today Date = " + new Date());
System.out.println("Today as julian date = " + sdfJulianDate.format(todayJD));
System.out.println("Today as day of year = " + sdfJuliandayOfYear.format(todayJD));
OUTPUT:
USING : Date todayJD = cal.getGregorianChange();
Today Date = Thu Nov 02 15:17:05 IST 2006
Today as julian date = 94229
Today as day of year = 229
USING : cal.set(Calendar.DATE, new Date().getDate());
Today Date = Thu Nov 02 15:19:22 IST 2006
Today as julian date = 06319
Today as day of year = 319
USING : Date todayJD = cal.getTime();
Today Date = Thu Nov 02 15:17:59 IST 2006
Today as julian date = 06306
Today as day of year = 306
There is one another concept i found to get the Julian day of the year as per the Julian day chart mention on nasa site (http://angler.larc.nasa.gov/armsgp/JulianDayChart.html) and i m getting the moth of the year that is 306 for nov 02 2006 using getTime() method in above code then the out put is right for Julian day. But it was not as per the expected Julian date format. So in conclusion we can only able to retrieve the day of year for the Julian calendar. hope their will be a solution for this problem in java api ....else we allways have to depend upon the third party api that was not accepteble some times.....
Kindly chk chart on the site
http://angler.larc.nasa.gov/armsgp/JulianDayChart.html
http://weather.uwaterloo.ca/julian.html
http://www.fs.fed.us/raws/book/julian.shtml
Thanks,
Tushar Lad -
How to get pivot table by using dates
Hi,
How to get pivot table by using dates in column.
Below is the sample table and its value is given.
create table sample1
Order_DATE DATE,
order_CODE NUMBER,
Order_COUNT NUMBER
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),1,232);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),2,935);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),3,43);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),4,5713);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),5,11346);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),1,368);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),2,1380);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),3,133);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),4,7109);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),5,14336);
select * from sample1;So how to get the data like below.
order_date
order_code 30-sep-12 29-sep-12
1 232 368
2 935 1380
3 43 133
4 5713 7109
5 11345 14336Using the extra data I inserted in my previous reply:select ORDER_CODE,
SUM(DECODE(extract (month from ORDER_DATE),1,ORDER_COUNT,0)) JAN,
SUM(DECODE(extract (month from ORDER_DATE),2,ORDER_COUNT,0)) FEB,
SUM(DECODE(extract (month from ORDER_DATE),3,ORDER_COUNT,0)) MAR,
SUM(DECODE(extract (month from ORDER_DATE),4,ORDER_COUNT,0)) APR,
SUM(DECODE(extract (month from ORDER_DATE),5,ORDER_COUNT,0)) MAY,
SUM(DECODE(extract (month from ORDER_DATE),6,ORDER_COUNT,0)) JUN,
SUM(DECODE(extract (month from ORDER_DATE),7,ORDER_COUNT,0)) JUL,
SUM(DECODE(extract (month from ORDER_DATE),8,ORDER_COUNT,0)) AUG,
SUM(DECODE(extract (month from ORDER_DATE),9,ORDER_COUNT,0)) SEP,
SUM(DECODE(extract (month from ORDER_DATE),10,ORDER_COUNT,0)) OCT,
SUM(DECODE(extract (month from ORDER_DATE),11,ORDER_COUNT,0)) NOV,
SUM(DECODE(extract (month from ORDER_DATE),12,ORDER_COUNT,0)) DEC
from SAMPLE1
where trunc(order_date, 'YY') = trunc(sysdate, 'YY')
group by order_code
order by order_code;
ORDER_CODE JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
1 0 0 0 0 0 0 0 0 600 600 0 0
2 0 0 0 0 0 0 0 0 2315 2315 0 0
3 0 0 0 0 0 0 0 0 176 176 0 0
4 0 0 0 0 0 0 0 0 12822 12822 0 0
5 0 0 0 0 0 0 0 0 25682 25682 0 0Now a bit of explanation.
1) Whenever you pivot rows to columns, no matter what version of Oracle and no matter what method you use, you have to decide in advance how many columns you are going to have and what the names of the columns are. This is a requirement of the SQL standard.
2) I use the WHERE clause to get just the data for this year
3) With EXTRACT, I get just the month without the year.
4) Using DECODE, I put every month's data into the correct column
5) Once I do all that, I can just GROUP BY order_code while SUMming all the data for each month.
Maybe you are looking for
-
Retstriction of confirmation dates in past dates in production order
Hi All, I have a issue with dates In our system production orders are created in advance at once in mass...suppose a production order is having start date and end date as 01.08.2014 and 07.08.2014. Now user taking this production order and proceeding
-
Error after re-installing mac OS X 10.5....
So I took my Imac to the Mac store and a tech looked at it and came to the conclusion I need to un-install Mac OS X 10.5 and re-install it with a clean slate... I did and at the end of the download an error came up saying about not being able to down
-
Application Not Responding Creative Suite
Having major problems with Application Not Responding in Creative Suites 5 & 6. Whenever trying to quit applications, more than not have to force quit. Would like to be able to quit out of Adobe Apps without force quitting. Also get a lot of spinning
-
Hello there, I have an issue. I just bought HP Pavilion 15-n246se notebook and I tried to connect it with TV by HDMI cable, that is work properly with other electronics, but there was no display on TV. What is the reason? I'm using Windows 7 as an op
-
Unix file to be converted to proper excel format
Hi Ima writing data to unix file but when i want to download from there in excel format i data is not not aligned in excel format please let me know the seperator to be used to upload to unix which can be converted to excel with good alignment. i tri