Getting Month from date
Hi All,
I have two date characteristics Start date and Pricing date. now i need to create a query, showing the month of start date and Pricing in two seperate columns.
suppose start date = 08/15/2007
pricing date = 10/20/2007
then in the query i need to have two columns with output
Start data month... |.........pricing date month
..........08..............|......... 10
Any advice on how to acheive this.
Thanks
Kumar
Try this
DATA: L_S_RANGE TYPE RSR_S_RANGESID.
DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.
CASE I_VNAM.
WHEN 'yourvar'.
IF I_STEP=2. "after the popup
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'variablename where user entry'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = LOC_VAR_RANGE-LOW+4(2). "YYYYMMDD
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
EXIT.
ENDLOOP.
ENDIF.
Similar Messages
-
I want to get the month from a date. I know how I can get it from today's date, but let's say I have a pre-defined date like:
String myDate = "11/15/89";How can I get "November" from that?
Edited by: TheTitans on Feb 12, 2009 4:56 PMSimpleDateFormat[http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html]
~ -
Getting month from Calendar Year/month...
Dear All,
I'm using Webi 4.0 SP6 and I need to get months from Calendar Year/Month which I'm using in a query to display on Cross Table along with brands.
1. Is there any standard function available to convert Calandar Year/Month (Say: 201401 to Jan or January).?
2. How can I get month from Calendar Year/Month for cross-table?
I will appreciate your reply.
Many Thanks!!!
Tariq AshrafTariq,
Month = Substr([Cal Year];5;2)
Month Name = If Substr([Cal Year];5;2) = "01" then "Jan"
else if Substr([Cal Year];5;2) = "02" then "Feb"
else if Substr([Cal Year];5;2) = "03" then "Mar"
else if Substr([Cal Year];5;2) = "04" then "Apr"
else if Substr([Cal Year];5;2) = "05" then "May"
else if Substr([Cal Year];5;2) = "06" then "Jun"
else if Substr([Cal Year];5;2) = "07" then "Jul"
else if Substr([Cal Year];5;2) = "08" then "Aug"
else if Substr([Cal Year];5;2) = "09" then "Sep"
else if Substr([Cal Year];5;2) = "10" then "Oct"
else if Substr([Cal Year];5;2) = "11" then "Nov" else "Dec"
If you have data like 20140101 then simply use = formatdate([Date];"Mon") -
Picking Month from Date in ABAP query
Dear All,
I want to pick month from date in a abap query but it is giving error "BDTER" is not a valid comparison operator. comparison operator.
Where i am wrong my query is below.
SELECT SUM( BDMNG ) AS BDMNGT FROM RESB INTO CORRESPONDING FIELDS OF IT_MRP
WHERE MONTH( BDTER ) = '12'.
With Regards
Ashwani K MathurDear Deepankar,
Thanks for reply.
Date fomat is yy/mm/dd (like 20071231) after your suggestion i have modified query.
SELECT SUM( BDMNG ) AS BDMNGT FROM RESB INTO CORRESPONDING FIELDS OF IT_MRP
WHERE BDTER+4(2) = 12.
but while compiling it is giving error Field "BDTER+4(2)" unknown.
Please suggest.
Ashwani K Maathur -
Get month from a date column ina table
Hi
I have a table that consists of one column of date data type. For example it stores mm/dd/yyyy.
I want to get all the records from this table where month = 12. for the year 2000.
I saw the extract function. However That is used while selecting. How can I give a condition in where clause:
select date_col
from dates-table
where <get month for date_col> = december or 12
and year = 2000???Ok that certainy helps.
This is what I am trying to do.
I have a procedure to which I am passing the date_param (of date data type).
declare
my_month date;
begin
select to_char(date_param,'MM') into my_month from dual;
select date_col from dates-table where to_char(date_col,'mm')= my_month and some_indicator='Y';
end;This will return me one date where the indicator is set to Y.
For example date_param is passed as 01/01/2000.
select to_char('01/01/2000','MM') from dual;I get the error when I run the above. I get an error saying invalid number. -
Using the EXTRACT function to get year and month from date
Hello~
I am trying to extract the month and year using the query below but am getting the error:
Query cannot be parsed within the Builder
select distinct city AS "CITY",count(MOTOR_ASSIST2.CITY) as "COUNT"
from "MOTOR_ASSIST2" "MOTOR_ASSIST2"
where
(:P53_FISCAL_YR IS NULL OR :P53_FISCAL_YR = MOTOR_ASSIST2.FY)
*OR (:P53_MONTH IS NULL OR EXTRACT(MONTH FROM :P53_MONTH) = MOTOR_ASSIST2.DATETIME)
OR (:P53_YEAR IS NULL OR EXTRACT(YEAR FROM :P53_YEAR) = MOTOR_ASSIST2.DATETIME))*
GROUP BY MOTOR_ASSIST2.CITY
ORDER BY CITY
Can anyone help me figure out what im doing wrong?Thanks
Deanna1. Whats the value of year you are passing here ??
2. Whats the value of months you are passing here??
Select City As "CITY", Count(Motor_Assist2.City) As "COUNT"
From "MOTOR_ASSIST2" "MOTOR_ASSIST2"
Where ((:P53_Fiscal_Yr Is Null Or :P53_Fiscal_Yr = Motor_Assist2.Fy) Or
(:P53_Month Is Not Null Or :P53_Month = Motor_Assist2.Month) And
(:P53_Year Is Not Null Or :P53_Year = Motor_Assist2.Year) And
Datetime >= To_Date(:P53_Year||:P53_Month, 'YYYYMON') And
Datetime > Add_Months(To_Date(:P53_Year||:P53_Month, 'YYYYMON'), 1)
Group By Motor_Assist2.City
Order By City
SQL> Select Sysdate From dual Where Sysdate = To_Date('2008'||'SEP', 'YYYYMON');
SYSDATE
Select Sysdate From dual Where Sysdate = To_Date('2008'||'SEP', 'YYYYMON');
SYSDATE
SQL> Select To_Date('2008'||'SEP', 'YYYYMON') From dual;
TO_DATE('2008'||'SEP','YYYYMON
9/1/2008
will give you sept 1st or 1st day of the month,
hows the data in your datetime column or variable ???
SQL> Select Sysdate From dual Where trunc(add_months(last_day(Sysdate),-1) +1) = To_Date('2008'||'SEP', 'YYYYMON');
SYSDATE
9/12/2008 3
SQL>
there both side of '=' yield first day of sept ...
SQL> -
How to get month last date and first date without FM's
Hi Guru's,
How can we get month's first date and last date based on the date given in selection screen without FM's?Is it possible ?
Like if i give 05-Oct-2008 in the selection screen, i should get the output as 01-Oct-2008 to 31-Oct-2008.Without FM's???
Regards
Rakesh.Hi Rakesh,
You can implement this logic as follows:
You can have two internal tables, one containing the days as numbered 31, 28, 31, and so on with the month number. This holds good if the year is a common year. Another internal table contains days as numbered 31, 29, 31 and so on with the month number. This year would be a leap year.
An year can be calculated depending on the conditions:
Say date is given as 20081008
Concatenate 20081001 + 0(4) into l_date.
Divide l_date by 4 and remainder should be equal to 0.
Divide l_date by 400 and remainder should also be equal to 0.
Then the dominical year will be a leap year.
Now, if l_date divided by 100 and the remainder is 0 then the year is a common year.
So depending on this populate the first date and last date from the respective internal table
Regards,
Sumalatha N. -
Restrict last date of month from date picker
Hi All,
I have a requirement to restrict the date picker.
I want to allow the user to select only the last date of the month from the following four months march, June, September and December.
I have googled about this i couldn't get related that except that restrict invalid days/months.
Please suggest to find solution for this.
My Jdev version is 11.1.2.0.0
Thanks in advance,
SANHi,
Have a backing bean to construct a list of days to be disabled and set that to disabledDays property of the picker component.
Ex : Re: Bug on the property "disabledDays" of the component af|inputDate ?
-Arun -
How to get valid from date in KONH Table
Hi ,
I am sending COND_A idoc for MRP. Now when I create a record using VK11,the valid from date is fine.
But while changing the same using VK12 changed date does not reflect in KONH Table (when the new valid from date is greater the the previous one) .I understand the SAP Logic behind this from previous threads .
But my issue is this :
Suppose I have a Material X created with Valid from = 10.01.2011 & valid to = 31.12.9999
Now I change this Valid from = 28.01.2011 & valid to = 31.01.2011.
Now how can I send the data for 28.01.2011 in my I-doc , as KONH still has 10.01.2011 as valid from date.even if you send the data for 28.01.2011, it should pick up the condition record because the start date for condition record is in past? why do you think it is a problem? now if your concern is that if your input date is 27.01.2011 and it should not pick this condition (that is a different matter altogether)...
-
CAML Query to get Items based on Year and Month From Date Column
Hi All,
* As we knew that there are default columns in calendar like Stattdate,Title,Location..etc.
* I required the CAML Query to get the list items of calender of particular Month and Year,So that I can get number of items or evetns are in Calendar
Can any one help me how can I do this using caml query
SamarHi Stuart,
Thanks for your response,I had chosen 2nd option of our above mention suggestion.But when I try to fetech the data from a calendar it is showing below error .I
had checked the below code with oter lists by changing Type to text and it worked fine.Can you please help me how can I fetech for the calulated columns
Error
"One or more field
types are not installed properly. Go to the list settings page to delete these
fields. "
Code:
string year="2014";
string month="February";
SPSite mysite = SPContext.Current.Site;
SPWeb myweb = mysite.OpenWeb();
try
SPList mylist = myweb.Lists["Calendar"];
SPQuery myquery = new SPQuery();
myquery.Query = @"<Where>
<And>
<Eq>
<FieldRef Name='Year'/>
<Value Type='Calculated'>"
+ year + @"</Value>
</Eq>
<Eq>
<FieldRef Name='Month'
/>
<Value Type='Calculated'>"
+ month + @"</Value>
</Eq>
</And>
</Where>";
SPListItemCollection totaltiems = mylist.GetItems(myquery);
Label1.Text= "Total Number of Items is "+" "+totaltiems.Count.ToString();
catch (Exception ee)
Label1.Text = ee.Message;
finally
myweb.Dispose();
Calculated Columns
Samar -
Get months from a date range comparing event date
Hi All,
Below is the data
CREATE TABLE #Coverage(
EmployeeID INT,
EmployeeName VARCHAR(20),
CoverageName VARCHAR(50),
CoverageAmount Decimal,
CoveredBy VARCHAR(20),
EventDate DATETIME,
CoverageStartDate DATETIME,
CoverageEndDate DATETIME
INSERT INTO #coverage VALUES (8,'Lara','Employee + Children',213.60,'EmployeeContribution','2013-10-01','2013-10-01','2014-05-31'),
(8,'LAra','Employee + Children', 606.31 ,'CompanyContribution' ,'2013-10-01','2013-10-01','2014-05-31'),
(8,'LAra','Employee Only' ,0.00 ,'EmployeeContribution' ,NULL ,'2013-06-01','2014-05-31'),
(8,'LAra','Employee Only' ,431.55 ,'CompanyContribution' ,NULL ,'2013-06-01','2014-05-31'),
(8,'LAra','Employee Only' ,81.42 ,'EmployeeContribution' ,NULL ,'2012-06-01','2013-05-31'),
(8,'LAra','Employee Only' ,420.93 ,'CompanyContribution' ,NULL ,'2012-06-01','2013-05-31')
SELECT * FROM #Coverage
drop table #coverage
and expected out put for the year 2013
EmployeeID
EmployeeName
CoverageName
CoverageAmount
CoveredBy
Month
Year
8
Lara
Employee Only
81
Employee Contibution
1
2013
8
Lara
Employee Only
421
Company Contribution
1
2013
8
Lara
Employee Only
81
Employee Contibution
2
2013
8
Lara
Employee Only
421
Company Contribution
2
2013
8
Lara
Employee Only
81
Employee Contibution
3
2013
8
Lara
Employee Only
421
Company Contribution
3
2013
8
Lara
Employee Only
81
Employee Contibution
4
2013
8
Lara
Employee Only
421
Company Contribution
4
2013
8
Lara
Employee Only
81
Employee Contibution
5
2013
8
Lara
Employee Only
421
Company Contribution
5
2013
8
Lara
Employee Only
81
Employee Contibution
6
2013
8
Lara
Employee Only
421
Company Contribution
6
2013
8
Lara
Employee Only
81
Employee Contibution
7
2013
8
Lara
Employee Only
421
Company Contribution
7
2013
8
Lara
Employee Only
81
Employee Contibution
8
2013
8
Lara
Employee Only
421
Company Contribution
8
2013
8
Lara
Employee Only
81
Employee Contibution
9
2013
8
Lara
Employee Only
421
Company Contribution
9
2013
8
Lara
Employee +Children
214
Employee Contibution
10
2013
8
Lara
Employee +Children
606
Company Contribution
10
2013
8
Lara
Employee +Children
214
Employee Contibution
11
2013
8
Lara
Employee +Children
606
Company Contribution
11
2013
8
Lara
Employee +Children
214
Employee Contibution
12
2013
8
Lara
Employee +Children
606
Company Contribution
12
2013
Can any one help me out with this.
Thanks!This gives your resultset.
I've added the cte to give a newenddate because your dataset doesn't close off the previous one in all cases and gave duplicates - you can remove this if it is a mistake in the data. Also you would need to add the employee to the partition to run on multiple
employees.
declare
@Coverage TABLE (
EmployeeID
INT,
EmployeeName
VARCHAR(20),
CoverageName
VARCHAR(50),
CoverageAmount
Decimal,
CoveredBy
VARCHAR(20),
EventDate
DATETIME,
CoverageStartDate
DATETIME,
CoverageEndDate
DATETIME
INSERT
INTO @Coverage
VALUES (8,'Lara','Employee + Children',213.60,'EmployeeContribution','2013-10-01','2013-10-01','2014-05-31'),
(8,'LAra','Employee
+ Children', 606.31
,'CompanyContribution'
,'2013-10-01','2013-10-01','2014-05-31'),
(8,'LAra','Employee
Only'
,0.00 ,'EmployeeContribution'
,NULL ,'2013-06-01','2014-05-31'),
(8,'LAra','Employee
Only'
,431.55
,'CompanyContribution'
,NULL ,'2013-06-01','2014-05-31'),
(8,'LAra','Employee
Only'
,81.42 ,'EmployeeContribution'
,NULL ,'2012-06-01','2013-05-31'),
(8,'LAra','Employee
Only'
,420.93
,'CompanyContribution'
,NULL ,'2012-06-01','2013-05-31')
SELECT
* FROM
@Coverage
;with
ctee1 as
select
*, seq
= row_number()
over (partition
by coveredby
order by coveragestartdate)
from
@Coverage
,ctee
as
select
c1.*,
newenddte = coalesce(c2.coveragestartdate-1,
c1.coverageenddate)
from
ctee1 c1
left
join ctee1
c2
on
c1.coveredby
= c2.coveredby
and
c1.seq
= c2.seq-1
cte1 as
select
dtestrt =
convert(datetime,'20130101'),
dteend =
convert(datetime,'20131201')
,cte
as
select
dtestrt =
cte1.dtestrt,
dteend =
dateadd(mm,1,cte1.dtestrt)-1,
mth =
month(cte1.dtestrt),
yr =
year(cte1.dtestrt)
from cte1
union
all
select
dtestrt =
dateadd(mm,1,cte.dtestrt),
dteend =
dateadd(mm,2,cte.dtestrt)-1,
mth =
month(dateadd(mm,1,cte.dtestrt)),
yr =
year(dateadd(mm,1,cte.dtestrt))
from cte,
cte1 where
cte.dtestrt
< cte1.dteend-1
select
c.EmployeeID,
c.EmployeeName,
c.CoverageName,
c.CoverageAmount,
c.CoveredBy,
cte.mth,
cte.yr,
cte.dtestrt,
cte.dteend
from
cte
join
ctee c
on
cte.dtestrt
<= c.newenddte
and cte.dteend
>= c.CoverageStartDate
order
by c.EmployeeID,
cte.dtestrt -
hi,
I have a query in Informix which get the month part of a date. Please help me in converting the same to oracle.
Informix query
select month(col1 - today) from tab1;
col1 is a date field, today will yield the current date and month function will get the month of the date.
In oracle, when we subtract two dates we will get a number value, how to convert that back to date and extract the month part.
Help me?????
Regards,
Gopuselect months_between(sysdate, col1)
from tab1;
This will return a decimal value representing the months and part month between the two periods. The later date should be specified first, or the result will be a negative value. -
Extract a month from date hierarchy
I have ssrs report based on cube. I have a date hierarchy where. date hierarchy is Year-Quarter-MonthYear. EG
2014-Q2-May,2014. as labels display
Values is like this:[Date].[Year to Month].[Month].&[2002]&[7]. How Can I extract month number like 7 from here so that I can do less than or equal in IIF is ssrs charts.
I want to compare months with user input month so that I can restrict data in charts. If user select march,2014. I will display data from Jan 2014- Mach 2014 for actual.How is the user selecting the month? Is month parameter a free text field? If you're using MDX itself to populate month values then selected month value would be passed in same format itself ie [Date].[Year
to Month].[Month].&[2002]&[7] etc
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
I have a Column that is defined as "DATE".it also Contains Time.........
I want to Get the Time only....so when i am using this
to_date(var_date,'hh12:mi:ss PM'),it is giving me date also and when i am using this
to_char(var_date,'hh12:mi:ss PM') then it is giving me all values similar to one of the top values in Column....
Then i Used EXTRACT function as
Select EXTRACT(HOUR FROM VAR_DATE).......
THEN IT THRWOING ERROR.......INVALID EXTRACT FIELD FOR EXTRACT SOURCE........
pLZ HELP HOW TO GET TIME...................................ONLY WITH AM AND PM......
Thanks in AdvanceHi,
to_char function should give the result as expected.
SQL> select to_char(sysdate, 'hh12:mi:ss PM') from dual ;
TO_CHAR(SYS
11:39:16 AM
SQL> select to_char(sysdate, 'hh12:mi:ss AM') from dual ;
TO_CHAR(SYS
11:39:32 AM
SQL> select to_char(sysdate,'hh:mi:ss') from dual ;
TO_CHAR(
11:40:04
SQL> select to_char(sysdate,'hh:mi:ss am') from dual ;
TO_CHAR(SYS
11:40:18 am
SQL> select to_char(sysdate,'hh:mi:ss pm') from dual ;
TO_CHAR(SYS
11:40:31 am
Thanks,
Siva -
Does ichat or FaceTime usage get deducted from data allowance
Am going home to Australia for vacation and taking my parents a macbook Air so we can stay in touch through iChat or FaceTime. (I live in CA) They do not have the option for unlimited data internet where they live. They have to purchase 30GB or 50GB per month. I have never used iChat or FaceTime before and was wondering if anyone can tell me if we use these applications will it eat up the data allowance quickly.
It will definitely eat into the data allowance and using video will use it up more quickly. If you're concerned about data allowance usage then use audio only on iChat, or install Skype and make audio only calls.
Maybe you are looking for
-
Can't boot into Windows 7 after using Boot Camp
So I installed Windows 7 on a separate 70GB partition using Boot Camp. Everything seems fine, but once installation finished and the computer restarted for the final time, the computer shows the blinking "_" on the black screen and then promptly rebo
-
PC, PP CS5, importing mp4's I only get 1 audio channel instead of all 4...? I put the clips in Vegas & all 4 channels appear. What can I do? Going insane!!! Steve
-
How to upload a Flat file into sap database if the file is in Appl'n Server
Hello Sap Experts , Can you tel me " How to upload a Flat file into sap database if the file is in Application Server. what is Path for that ? Plz Tel Me its Urgent Thanks for all
-
Print Option on User Define Field
Hello All, It is possible to take the printout of User Define Field. I tried it in the PLD. But what is the problem is, I created some UDF, In that some UDF direct entry , some other UDF are llike drop down UDF. When I tried in the PLD on
-
Where can i buy battery for macbook air 11 inch
i've poured cappucino on my macbook air 11 inch >.< after that i couldn't work with my lap top unless the battery is plugged in when i went to fix it they say i need to buy NEW Battery and the old one is going to die sooner