Default Month and Year in Date Paramater
Hi,
I have a question and not able to understand how to show a default current month year i.e 112010 as a deualt value in the prompt.
Thanks in Advance,
Poojak
one more problem i found with that code is:
if current date is January's date, it gives 12010 instead of 012010 and if you are filtering column is holding values like mmyyyy format, it'll give no results..
i want you to create a repository variable which holds current_date format in mmyyyy format..
now, use that repository variable here in default section by selecting server variable..
select to_Char(sysdate, 'mm') || to_Char(sysdate, 'yyyy') from dual
Similar Messages
-
Getting Day, month and year from Date object
hello everybody,
Date mydate = Resultset.getDate(indexField);
Now i would like to get day, month and year from mydate.
In another words, i'm looking for something equivalent to
mydate.getDay() as this method is deprecated.
Can somebody help me out please?
Thank you in advance,swvc2000,
Here is a sample class that demonstrates two ways in which to do this.import java.util.*;
import java.text.*;
public class DateSplitter {
public static void main(String args[]) {
/* even though your date is from a result set,
pretend the following date is your date that
you are using. The try catch block is used
because I hand-crafted my date using
SimpleDateFormat. Substitute your date.*/
Date yourDate = null;
try {
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
yourDate = formatter.parse("05/06/2000");
} catch (ParseException e) { }
//the following gets the current date
Calendar c = Calendar.getInstance();
//use the calendar object to set it to your date
c.setTime(yourDate);
//note months start at zero
int month = c.get(Calendar.MONTH);
int year = c.get(Calendar.YEAR);
int dayOfMonth = c.get(Calendar.DAY_OF_MONTH);
System.out.println("Calendar Month: "+month);
System.out.println("Calendar Day: "+dayOfMonth);
System.out.println("Calendar Year: "+year);
System.out.println();
/* Simple date format can also be used to strip them
out of your date object. When you use it, notice that
months start at 1. Also, it returns string values. If
you need integer values, you will have to use
Integer.parseInt() as I did below. If you are
only concerned about the string values, just remove
the Integer.parseInt part. */
DateFormat formatter = new SimpleDateFormat("M");
month = Integer.parseInt(formatter.format(yourDate));
System.out.println("SDF Month: "+ month);
formatter = new SimpleDateFormat("d");
dayOfMonth = Integer.parseInt(formatter.format(yourDate));
System.out.println("SDF Day: "+ dayOfMonth);
formatter = new SimpleDateFormat("yyyy");
year = Integer.parseInt(formatter.format(yourDate));
System.out.println("SDF Year: "+ year);
}//end main
}//end DateSplitter classtajenkins -
Loop through month and year till date while using a merge statement
Hello Guys,
I have 2 tables with the following datas in them:-
Company
CompanyId CompanyName
1 Company1
2 Company2
3 Company3
Employees
EmployeeId EmployeeName CompanyId StartDate
1 Employee1 1 12/21/2011
2 Employee2 1 01/20/2012
3 Employee3 2 03/23/2012
4 Employee4 2 07/15/2012
5 Employee5 2 01/20/2013
6 Employee6 3 12/17/2013
Now i want to check, How many people were recruited in the team in the specified month and year? I have the storage table as follows:-
RecruiterIndicator
CompanyId Year Month EmployeeRecruited
1 2011 12 1
1 2012 1 1
2 2012 3 1
2 2012 7 1
2 2013 1 1
3 2013 12 1
This should be a merge stored procedure that should update the data if it is present for the same month year and company and insert if that is not present?
Please help me with this
Thanks
AbhishekIt's not really clear where the merge to come into play. To get the RecruiterIndicator table from Employess, this query should do:
SELECT CompanyId, Year(StartDate), Month(StartDate), COUNT(*)
FROM Employees
GROUP BY CompanyId, Year(StartDate), Month(StartDate)
Erland Sommarskog, SQL Server MVP, [email protected] -
Get month and year from date type
Hi all,
I need to get the month and year from the date type.
For example select to_date('2011-01-17', 'yyyy-mm-dd') from dual;Result needed:
01-2011Any ideas?
thanks in advance,
Bahchevanov.Hello Bahchevanov,
if you need the date to compute something, then you can
TRUNC(SYSDATE,'mm')This will give you a date with the days removed -> 01.01.2011
Regards
Marcus -
Month and Year-To-Date Grouping
Hello,
I have 4 key figures. For each of the key figures I need to display the value for the month and the value for the year-to-date. Example, if the user selects October as the month the query should display only the totals for October and the totals from January to October. The user does not want to see the totals for January, February, March and so on.
........................Month of October.................Year-To-Date
No. of Orders .................. 3,005..................... 22,950
Order Value ..................190,000................ 5,900,000
Canceled Orders .....................7........................... 60
Value of Canceled Orders......700........................8000
Can someone tell me how I go about doing that?Hello MIG,
I guess you can create a structure for your key figures at the rows area of the query and a structure for your dates (e.g. fiscal periods) at the columns area. For your columns, you will need two restricted key figures. The first key fgure will be for your user's current month (e.g. Oct) -- this will be equal to fiscal year/period restricted by a user entry variable for the current month. The second key figure will be for your year to date KF (e.g. Jan to Oct) -- this will be equal to fiscal year/period restricted by a customer exit variable that computes for the date range between Jan and the user's current month. <b>OR</b> you can ask the user to input the initial date (should be defaulted to Jan 2006*) and the current month in a date range -- this will be an interval variable. Hope this helps.
Juice -
Using an expression in SSRS to display rolling 12 month and year to date volumes
I need some help in writing an expression in SSRS. I have a table that contains date columns and rows that contain different types of data groups. (e.g. total number of items received during the month, total dollars for the month, etc.) I want to add two
new columns to the end of the report that will display a rolling twelve month total for each of the different rows of data. Plus a column that would show year to date totals for the same rows.
I was thinking I could accomplish this by adding expressions for each row in the new 'rolling twelve month' and 'YTD' columns in my report however, I'm not sure how to structure the expressions to achieve this.
Here is an example of how my report currently looks. (I added a pipe delimeter in case the formatting changes once this is submitted.)
Jan-2014 | Feb-2014 | Mar-2014 | Apr-2014 | Rolling 12 mth | YTD
Items received 100 | 35 | 45 | 12 | 192 | 192
Dollars $50.00 | $25.00 | $120.00 | $15.00 | $210.00 | $210.00
Any guidance you can provide would be appreciated.
Thank youThis example shows how to get what you need. It'll take modifying your query to add two cased columns onto the end.
DECLARE @forumTable TABLE (periodYear INT, periodMonth INT, periodMonthName VARCHAR(12), periodDollars MONEY, periodItems INT)
DECLARE @i INT = 0
SET NOCOUNT ON
WHILE @i < 24
BEGIN
INSERT INTO @forumTable (periodYear, periodMonth, periodMonthName, periodDollars, periodItems)
VALUES (YEAR(DATEADD(MONTH,-@i,GETDATE())), Month(DATEADD(MONTH,-@i,GETDATE())), DATENAME(MONTH,DATEADD(MONTH,-@i,GETDATE())), 1000-@i, 100-@i)
SET @i = @i+1
END
SET NOCOUNT OFF
SELECT *,
CASE WHEN CONVERT(VARCHAR,periodYear) + '-' + CONVERT(VARCHAR,periodMonth) + '-01' > DATEADD(MONTH,-12,GETDATE()) THEN periodItems ELSE 0 END AS ytdItems,
CASE WHEN CONVERT(VARCHAR,periodYear) + '-' + CONVERT(VARCHAR,periodMonth) + '-01' > DATEADD(MONTH,-12,GETDATE()) THEN periodDollars ELSE 0 END AS ytdDollars
FROM @forumTable -
Find month and year of a given date
Hi,
How to find the month and year of a given date.
month ( sy-datum) year ( sy-datum )
--Balahi
DATA: EDAYS LIKE VTBBEWE-ATAGE,
EMONTHS LIKE VTBBEWE-ATAGE,
EYEARS LIKE VTBBEWE-ATAGE.
PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
Call Function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = FROMDATE
i_date_to = TODATE
I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ 'Difference in Days ', EDAYS.
WRITE:/ 'Difference in Months ', EMONTHS.
WRITE:/ 'Difference in Years ', EYEARS.
INITIALIZATION.
FROMDATE = SY-DATUM - 60.
Using teh abiove u can get difference but when u pass previous year u wont get the exact.
There is no seperate FM for this, u have to use three FM.
If possible using these three FM code u can create an FM.
For years and months between two days:
DATA: EYEARS LIKE VTBBEWE-ATAGE.
PARAMETERS: FROMDATE LIKE PREL-BEGDA,
TODATE LIKE PREL-BEGDA DEFAULT SY-DATUM.
CALL FUNCTION 'COMPUTE_YEARS_BETWEEN_DATES'
EXPORTING
first_date = fromdate
MODIFY_INTERVAL = ' '
second_date = todate
IMPORTING
YEARS_BETWEEN_DATES = EYEARS
EXCEPTIONS
SEQUENCE_OF_DATES_NOT_VALID = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Write:/ eyears.
DATA: EMONTHS LIKE VTBBEWE-ATAGE.
PARAMETERS: FROMDATE LIKE SY-DATUM,
TODATE LIKE SY-DATUM
DEFAULT SY-DATUM.
CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = fromdate
i_datum_von = todate
I_KZ_INCL_BIS = ' '
IMPORTING
E_MONATE = emonths
write:/ emonths
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
I_DATUM_BIS = x_faede-zfbdt
I_DATUM_VON = p_fdat
I_KZ_EXCL_VON = '0'
I_KZ_INCL_BIS = '0'
I_KZ_ULT_BIS = ' '
I_KZ_ULT_VON = ' '
I_STGMETH = '0'
I_SZBMETH = '1'
IMPORTING
E_TAGE = dias_v.
IF SY-SUBRC <> 0.
ENDIF.
x_faede-zfbdt -> 20050915
p_fdat -> 20050811
dias_v = 4
try this and let me know.
regards
ravish
<b>plz dont forget to reward useful points</b> -
Need to combine month and year to get date YYYY-MM-DD format
Month and year are table fields and they will have values like
Month in format = mm example 01
year in format = YYYY example 2010
Now i need to concatenate month and year to derive date .
Expected result Result :2010-01-01
Example :Month =01
Year =2010
MudassarThe principle of any tiered architecture is that display formatting is done in a presentation layer. This is not just SQL and Client/Server programming; it is the foundation of all modern programming. Not knowing this is like a doctor who does not know
about germs or a chemist who does not know about atoms.
This is reviewed in the first 1-2 weeks of any database class. Why are you violating it??
Next, you do not even know that column are not fields!
T-SQL now has a DATE data type, which defaults to the ISO-8601 display format (yyyy-mm-dd). Are you using it? If you had been polite we would see your DDL and know.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
I want to keep date special month and year.
I want to keep date special month and year.
Example in sqlplus
insert into area(input_time) values(to_date('MAR-04','MON-YY'));
and select
select input_time from area;
the result
01 MAR 2004
in Oracle
01-MAR-2004 12:00:00 AM
I don't keep day, but I want to keep month and year.
Can you do?
Thanks.An Oracle date column must contain a date down to the second. If you don't specify a day or a time, it will default to the first of the month and midnight.
If you want a column to only contain values at the beginning of a particular month, you can create a CHECK constraint that verifies that
input_time = trunc( input_time, 'MM' )Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How to get Week,Month and Year details from a date column
Hi frenz,
I've a column like tran_date which is a date column..... I need the next week details based on this column and so on...
I need month and year details as well based on this tran_date column.... can any one tell me how...
Thanks in advanceMy example for objects:
create or replace type date_object as object
centure number,
year number,
month number,
day number,
hour number,
minute number,
second number,
daypart number,
week number,
constructor function date_object(p_dt date)
return SELF as result
create or replace type body date_object is
constructor function date_object(p_dt date)
return SELF as result
as
begin
SELF.centure:= trunc(to_char(p_dt,'YYYY')/100);
SELF.year:= to_char(p_dt,'YYYY');
SELF.month:= to_char(p_dt,'MM');
SELF.day:= to_char(p_dt,'DD');
SELF.hour:= to_char(p_dt,'HH24');
SELF.minute:= to_char(p_dt,'MI');
SELF.second:= to_char(p_dt,'SS');
SELF.daypart:= p_dt-trunc(p_dt,'DD');
SELF.week:= to_char(p_dt,'IW');
return;
end;
end;
select date_object(sysdate),
date_object(sysdate).year
from dual;Regards,
Sayan M. -
Month to Date and Year to Date Scenarios
<b>Dear SAP BI Gurus,
Can anyone please give me guidance how to create a Month to Date and Year To Date Scenarios (Variables perhaps?) for 0SRR_CF_C1? The date is in decimal and not DATE format Im assuming the reason for this is to get the Time variance . Nonetheless, Id like to create a MTD and YTD scenario for reporting.
Much Thanks
Philips Manalaysay</b>Hi,
You should take a look at the blog and doc below.
/people/vikash.agrawal/blog/2006/10/17/enable-trend-reporting-150-by-manipulating-variable-value
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
Regards, -
Data element for Month and Year
Hello All,
Is there any data element which will have only Month and Year.
I have to introduce this field in a table. It should have convesion exits also.
Ex: If i give 092009, it sould come like 09.2009
Thank you.
Best Regards,
Sasidhar Reddy Matli.Kindly Try this code for Month and year as input and having standard F4 help..
INCLUDE RMCS0F0M.
TYPES : BEGIN OF TY_SELECT,
MONTH TYPE FTI_MONTH_YEAR,
END OF TY_SELECT.
DATA : WA_SELECT TYPE TY_SELECT.
SELECTION-SCREEN : BEGIN OF BLOCK SANDEEP WITH FRAME.
SELECT-OPTIONS : S_MONTH FOR WA_SELECT-MONTH OBLIGATORY NO INTERVALS NO-EXTENSION.
SELECTION-SCREEN : END OF BLOCK SANDEEP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MONTH-LOW.
PERFORM MONAT_F4.
SANDEEP JAIN -
Problem to insert only month and year instead of full date
select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'dd/mm/yyyy') and to_date(:TO,'dd/mm/yyyy')
order by b.penjara_id, a.bulan_proses,a.no_daftarHi,anyone can help me how i can insert only month and year from the value that have full date in the database??
for example,the date is 09/18/2012, but i just want to insert 09/2012 as parameter. If i want to insert only one parameter, i can do that..But i have problem when I want to insert two parameters..jeneesh wrote:
Welcome to the forum..
This..?
Assuming bulan_proses is a date without time part
select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'mm/yyyy') and last_day(to_date(:TO,'mm/yyyy'))
order by b.penjara_id, a.bulan_proses,a.no_daftar
i got another problem..
before that.may i know what is the function of last_day? -
To get first date and end date after entering any month and year
Hi,
I need to to get first date and end date of a month and year in yyyyMMdd format. I am reading month and year from a properties file. But I don't know how to get the first date and End date in given format. The properties file gives me just text. But I don't know how to get the date format using this. I need this urgently. Can anyone help me to get code for this?
I am reading the fields as,
Properties props = new Properties();
props.load(new FileInputStream("AnyMonthVolume.properties"));
String date_month = props.getProperty("date_month");
String date_year = props.getProperty("date_year");
Thanks.I know this has been posted a while ago but incase someone looking for it, here is the code to get the end of current month date.
Calendar cal = Calendar.getInstance();
cal.setTime(new java.util.Date());
cal.set(Calendar.DATE, 1); //set the date to start of month
cal.add(Calendar.MONTH,1);
cal.add(Calendar.DATE,-1);
System.out.println(cal.getTime()); -
When my delegates are filling in a event form i have put together, a large number of them forget to change either the month or year on the date field. Is there a way to have a date field that has drop down boxes for day, month and year so they have to choose rather than a date been already on the screen??
ThanksHi Christopher,
The WEEKDAY function allows specifying either Sunday or Monday as the first day of the week:
WEEKDAY
The WEEKDAY function returns a number that is the day of the week for a given date. WEEKDAY(date, first-day)
 date: The date the function should use. date is a date/time value. The time portion is ignored by this function.
 first-day: An optional value that specifies how days are numbered.
Sunday is 1 (1 or omitted): Sunday is the first day (day 1) of the week and Saturday is day 7.
Monday is 1 (2): Monday is the first day (day 1) of the week and Sunday is day 7. Monday is 0 (3): Monday is the first day (day 0) of the week and Sunday is day 6.
But I think you are referring to the first day of the 'workweek', for which I do not see a means of defining a custom value.
Since you want to 'insert categories', though, you could easily define your own, using WEEKDAY(date) or WEEKDAY(date,1), plus an IF statement to return the category label appropriate to the day. Here's one for a Sunday to Thursday work week. Dates are in column A, the formula is in whichever column you want as the Category column. For the example, I've placed it in column B.
B2, and filled down: =IF(WEEKDAY(A)<6,"Work","Off")
The top table shows the weekday numbers returned for each day of the week for each of the three permitted values for the optional second argument. The bottom table shows the results from the formula above, used to define a category label for each date:
A10 was left blank intentionally, to determine if the lack of data resulted in an error. The Warning message, flagged by the blue 'warning' triangle, is "The formula uses a number in place of a date." The 'date' assigned to this numerical value of zero was a Friday, but I'm not certain when. Probably best to avoid extra rows with no date shown.
Regards,
Barry
Maybe you are looking for
-
I have just upgraded to Iphone 4S as my Iphone 3G failed. I want to transfer the data which I believe is stored in my Itunes account. But when I connect the phone to my computer nothing happens it just ask me if I want to download pictures or video.
-
Submit by email not working as form validation failed.
Ive created a form with mulitple pages. Three pages require form validation. Each page is a unique process so I'm trying to use the "Submit button" to only submit that particular page. I've created dummy fields as defaults to cure the validation prob
-
Communication through contextual events in ADF 11g?
hi everyone , I have a requirement that i have to establish a communication between two taskflows and communication between page and the two taskflows at a time through contextual events I'm able to establish a communication between two taskflow regi
-
Custom itemRenderer component based on cell value: error 1009
I'm working on an item renderer for a dataGrid that has different states depending on the cell and row values. The cell value is a toggle (true or null), and sets whether content should be shown in the cell or not The row properties determine what is
-
Hi, I am using BPM user deceision step .Email Id is configured in alrtcatdef.Can I get emails Ids dynamically?