Getting all dates of a particular month and year
I want to get list of all dates of a particular month and year .
How to get using Calendar List?
Create a Calendar object. Set it's month and year. Then call getActualMaximum(Calendar.DAY_OF_MONTH); on the Calendar object. That will tell you how many days are in the month of that year.
Similar Messages
-
Table for Material Quantity and Value for particular month and year
Hi All
My requirement is that for a particular month and year I want to know the stock quantity and stock value for a particular material for a given plant.From which SAP table can I get this data as I want to fetch data for my Y report?
Regards
Satish KumarHi,
You can use MB5B table as suggested earlier.also you can use:
MBEW-VMKUM --> stock for previous month period
MBEW-VJKUM --> stock for previous year period
PLease view these links which migh tbe helpful to you:
http://help.sap.com/saphelp_47x200/helpdata/en/39/55fee3bc6111d4b3960050dadf0791/content.htm
TableStock
Thanks
Nisha -
Need working days for a particular month and year
Hi,
I need the number of working days for a particular month and year.Saturdays and Sundays are holidays.
Regards,
VigneshTry this:
SQL> var yr NUMBER;
SQL> exec :yr := 2010;
PL/SQL procedure successfully completed.
SQL> with t as (select :yr yr from dual)
2 SELECT TO_CHAR(dat,'MON-RR'),COUNT(*) FROM
3 (select TO_DATE('01-JAN-'||yr) + lv dat FROM
4 (select level - 1 lv,yr from t
5 connect by level <= TO_DATE('31-DEC-'||yr) - TO_DATE('01-JAN-'||yr) + 1))
6 WHERE TO_CHAR(Dat,'DY') NOT IN ('SAT','SUN')
7 GROUP BY TO_CHAR(dat,'MON-RR');
TO_CHAR(DAT, COUNT(*)
APR-10 22
AUG-10 22
DEC-10 23
FEB-10 20
JAN-10 21
JUL-10 22
JUN-10 22
MAR-10 23
MAY-10 21
NOV-10 22
OCT-10 21
TO_CHAR(DAT, COUNT(*)
SEP-10 22
12 rows selected.
SQL> Edited by: AP on Jul 27, 2010 7:54 AM -
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()); -
Find the difference between two dates for the specific month and year
Hi,
I have two dates, start date is 30/12/2012 and end date is 04/01/2013. Using datediff I found the difference of days between two dates. But I find the no of days in January 2013. ie output is 4 instead of 6. I input month and year to find the no of days
for that date. In this case I input Jan 2013. How can I sql this ?I don't understand how most of the answers provided here not analytically solving the problem with many cases possible.
First let me understand you:
You have 2 dates range and you want to calculate day range for specific month and year between the original date range.
declare @for_month int = 1 --January
declare @for_year int = 2013
declare @StartDate date = '2012-12-20'
declare @EndDate date = '2013-01-04'
SELECT
CASE
WHEN (DATEPART(MONTH, @StartDate) = @for_month and DATEPART(MONTH, @EndDate) = @for_month) and ((DATEPART(YEAR, @StartDate) = @for_year or DATEPART(YEAR, @EndDate) = @for_year)) THEN
DATEDIFF(DAY, @StartDate,@EndDate)
WHEN (@StartDate < cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) and (@EndDate between (cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) and (cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date))) THEN
DATEDIFF(DAY, DATEADD(MONTH, DATEDIFF(MONTH, -1, @EndDate)-1, 0),@EndDate)
WHEN (@EndDate > cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date)) and (@StartDate between (cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) and (cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date))) THEN
DATEDIFF(DAY, @StartDate,DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, @StartDate) + 1, 0))) + 1
WHEN ((DATEDIFF(DAY, @StartDate, cast(DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date)) + 1, 0)) as date)) >= 0) and (DATEDIFF(DAY, cast(CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as date), @EndDate) >= 0)) THEN
DATEDIFF(DAY, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as datetime), DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, cast( CONVERT(varchar(4), @for_year) + '-' + CONVERT(varchar(2), @for_month) + '-01' as datetime)) + 1, 0))) + 1
ELSE
0
END as [DD]
I don't know how you calculate day range between 01/01/2013 and 04/01/2013
is 4, it is actually is 3 but if that is the case, you can add 1 from the condition. -
Date Picker: Only select Month and Year
Hallo,
I try to configure the Date Picker. For the users it should only be possible to select Month and Year. The column should be automaticly completed with the first day of the select month and a static time (00:00:00).
How can I do this?
SincerlyYou can't do that with a standard date picker. What you could do is to use it and after you change the value in it you modify the value using javascript and ajax similar to what I do in this example:
http://htmldb.oracle.com/pls/otn/f?p=31517:9
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Recurring Events not gets all data in a given month in C#
Help me about this. I cannot get all the records of recurring events in Calendar. Even using <Month> ,<Year>. it doesn't give the all records. that happens when adding no end date of recurrence.
ex. i want to filter all records on the 10-01-2018 by its month but it appears like in different result range of date. cause i've tried creating an event in calendar with recurrence of Daily weekday=true and no end date. then i don't why it doesn't give the
correct result and just tried this date as sample.
here's the image of what trying to get:
https://social.msdn.microsoft.com/Forums/getfile/621163
here's the data showing when getting it.
http://community.office365.com/cfs-file.ashx/__key/communityserver-discussions-components-files/154/0841.img.jpg
Here's the code:
var list = xWeb.Lists.TryGetList("TestCalendar");
var oQueryBookings = new SPQuery();
oQueryBookings.CalendarDate = new DateTime(2018,10 ,1);
oQueryBookings.ExpandRecurrence = true;
SPListItemCollection oCollBookings = null;
string strViewField = "<FieldRef Name='RecurrenceID' />" +
"<FieldRef Name='Duration' />" +
"<FieldRef Name='Title' />" +
"<FieldRef Name='EventDate' />" +
"<FieldRef Name='EndDate' />" +
"<FieldRef Name='Location' />" +
"<FieldRef Name='Category' />" +
"<FieldRef Name='Description' />" +
"<FieldRef Name='fRecurrence' />" +
"<FieldRef Name='RecurrenceData' />" +
"<FieldRef Name='fAllDayEvent' />" +
"<FieldRef Name='TimeZone' />" +
"<FieldRef Name='EventType' />" +
"<FieldRef Name='UID' />" +
"<FieldRef Name='XMLTZone' />" +
"<FieldRef Name='LinkTitle'/>";
oQueryBookings.ViewFields = strViewField;
string strQuery =" <Where>" +
" <DateRangesOverlap> " +
" <FieldRef Name=\"EventDate\" /> " +
" <FieldRef Name=\"EndDate\" /> " +
" <FieldRef Name=\"RecurrenceID\" /> " +
" <Value Type=\"DateTime\" IncludeTimeValue=\"TRUE\"> " +
" <Month /> " +
" </Value> " +
" </DateRangesOverlap> " +
" </Where> " ;
oQueryBookings.Query = strQuery;
oCollBookings = list.GetItems(oQueryBookings);
if (oCollBookings.Count > 0)
DataTable objDatatable = new DataTable();
objDatatable = oCollBookings.GetDataTable();Hi,
Per my understanding, you might want to get all the recurring events within a specific month using C#.
Here is working code demo about getting recurring events by month for your reference:
public static void getRecurringEvents()
using (SPSite site = new SPSite("http://sp"))
using (SPWeb web = site.RootWeb)
SPQuery query = new SPQuery();
query.ExpandRecurrence = true;
query.Query = "<Where><DateRangesOverlap><FieldRef Name=\"EventDate\" /><FieldRef Name=\"EndDate\" />" +
"<FieldRef Name=\"RecurrenceID\" /><Value Type=\"DateTime\">" +
"<Month />" +
"</Value></DateRangesOverlap></Where>";
//get the events in the specific months
query.CalendarDate = DateTime.Now.AddMonths(-1);
SPListItemCollection calendarItems = web.GetList("/Lists/Calendar1").GetItems(query);
foreach (SPListItem item in calendarItems)
Console.WriteLine(item["Title"] + ": starts "
+ item["EventDate"].ToString() + " and ends "
+ item["EndDate"].ToString());
It will return all the recurring events of last month:
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Get the starting date and end date of all weeks of a given month and year
hey Guys so far I have this.. but I am having difficulty limiting it by month. I am using Oracle 11 release 1
Select year, week, next_day( to_date( '04-jan-' || year, 'dd-mon-yyyy' ) + (week-2)*7, 'sun' ) as weekStartDate,
next_day( to_date( '04-jan-' || year, 'dd-mon-yyyy' ) + (week-2)*7, 'sun' ) +6 as weekEndDate
from (Select '2012' year, rownum week from all_objects where rownum<=5)
Thanks in advance
Edited by: Aj05 on Jan 12, 2012 7:42 AMFirst you need to define week starting day. If, for example it is Monday:
TRUNC(TRUNC(&dt,'YYYY') -1,'IW')is first Monday of the year. Then:
SELECT TRUNC(TRUNC(&dt,'YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
FROM DUAL
CONNECT BY LEVEL <= 53
/will give start dates of all weeks within &dt year. And:
WITH t AS (
SELECT TRUNC(TRUNC(&dt,'YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
FROM DUAL
CONNECT BY LEVEL <= 53
SELECT week_start_date,
week_start_date + 6 week_end_date
FROM t
WHERE week_start_date > TRUNC(&dt,'MM')
AND week_start_date < ADD_MONTHS(TRUNC(&dt,'MM'),1)
/will give you week start/end dates within &dt year and month. For example:
SQL> DEFINE dt="DATE '2012-03-17'"
SQL> WITH t AS (
2 SELECT TRUNC(TRUNC(&dt,'YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
3 FROM DUAL
4 CONNECT BY LEVEL <= 53
5 )
6 SELECT week_start_date,
7 week_start_date + 6 week_end_date
8 FROM t
9 WHERE week_start_date > TRUNC(&dt,'MM')
10 AND week_start_date < ADD_MONTHS(TRUNC(&dt,'MM'),1)
11 /
old 2: SELECT TRUNC(TRUNC(&dt,'YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
new 2: SELECT TRUNC(TRUNC(DATE '2012-03-17','YYYY') -1,'IW') + (LEVEL - 1) * 7 week_start_date
old 9: WHERE week_start_date > TRUNC(&dt,'MM')
new 9: WHERE week_start_date > TRUNC(DATE '2012-03-17','MM')
old 10: AND week_start_date < ADD_MONTHS(TRUNC(&dt,'MM'),1)
new 10: AND week_start_date < ADD_MONTHS(TRUNC(DATE '2012-03-17','MM'),1)
WEEK_STAR WEEK_END_
05-MAR-12 11-MAR-12
12-MAR-12 18-MAR-12
19-MAR-12 25-MAR-12
26-MAR-12 01-APR-12
SQL> SY. -
How to get currect date by using month and year
hai,
By using month like 'Jul' and year like 2007 i want to get full date like 01/06/2007(format).Please give me query for this?My fields for month and year are respectively vr_mnth(varchar) and in_year(number)i used to_date function but it accepts only one string .if i give like this
to_date(vr_mnth,in_year,'dd/mm/yy') it will gives me syntax error.
If i give like this vr_mtnh='Jan'
to_date(vr_mtnh,'Mon') it will give output
01/01/2008 it shows me current year
if i choose from table wich is strored with month-'Jul' and year=2006 it shows me
01/07/2008 only .It doesn't shows me that 2006 year
If i give in_year in to_date it gives me that currect year.
Ex:to_date(in_year,'YY')..............>01/01/2006
Individually to_date function works fine but i want to club both to get accurate date format of specified month and year.Is there any function for that in sql to get 01/07/2006? -
Display month and year in dropdown list on selection screen
Hi
Can anyone tell me how to display months and year in a dropdown list on a selection screen?
also please tell me how to get the first and the last dates upon selecting the month and year on the dropdown list.
Month: January Year:2007 .
After selecting the required month and year, the first date and last date i.e '01.01.2007 - 31.01.2007' should be displayed on the right side.
Reward Points assured..
thanks,
ChetanHi..,
<b>
Just copy, paste and execute this program !!</b>
type-pools: vrm.
parameters : p_month(2) type n as listbox visible length 10,
p_year(4) type n as listbox visible length 10.
DATA : W_DATE type d, w_ldate type d.
initialization.
perform user_drop_down_list_fordt.
perform user_drop_down_list_foryr.
start-of-selection.
concatenate p_year p_month '01' into w_date.
call function 'BKK_GET_MONTH_LASTDAY'
exporting
i_date = w_date
IMPORTING
E_DATE = w_ldate
write /: w_date,w_ldate.
build user_drop_down_list
form user_drop_down_list_fordt.
data: name type vrm_id,
list type vrm_values,
value like line of list.
data: t_months type t247 occurs 0 with header line.
clear list. refresh list.
name = 'P_MONTH'.
select * into table t_months
from t247 where spras eq 'EN'.
sort t_months ascending by mnr.
loop at t_months.
clear value.
value-key = t_months-mnr.
value-text = t_months-ltx.
append value to list.
endloop.
Set the values
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
endform.
for year...
form user_drop_down_list_foryr.
data: name type vrm_id,
list type vrm_values,
value like line of list.
clear list. refresh list.
name = 'P_YEAR'.
do 9999 times.
clear value.
value-key = sy-index.
append value to list.
enddo.
Set the values
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
endform.
<b>
Hope this solves ur problem..</b>
regards,
sai ramesh -
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 -
Get day month and year of a date
Hi all i need to get the week day of a date, the week, the month, the year of a generic date.
Actually SimpleDateFormat is probably better. Calendar's months are opaque constants.
http://www.javaalmanac.com/egs/java.text/FormatDate.html -
A mate has an iphone 4 as a work phone, now he is leaving and needs to get all data incl messages etc onto an old iphone 3. Is this possible, any help appreciated.
RobbieYou won't be able to restore a device running iOS 4.2 from a backup of a device running iOS 5 (as you found out). And the Iphone 3G can only be updated to iOS 4.2.1 so there is no way to migrate from his iPhone 4 back to his iPhone 3G. He would have to at least have an iPhone 3GS, which will update to iOS 5.1 and would be able to restore from the iPhone 4 backup. Unfortunately, there isn't any way around it.
-
Could some body help me:
I am try to get Date, Month and Year
I got stuck, Anyone help me this:
public class DateMonth
public static void main(String[] args)
toDay = new toDay("February 21, 2002");
dayofWeek = today.getDay();
System.out.println("Current month is " + toDay.getMonth());
System.out.println("Current day is " + getDate());
System.out.println("Current year is " + toDay.getYear());
toDay.setDate(toDay.getDate()+60)
System.out.println("Sixty days from now is ");
System.out.println(toDay);
}Try something like this:
import java.util.*;
public class DateMonth {
public static void main(String[] args) {
// Note: 0 = January
Calendar calendar = new GregorianCalendar();
System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR));
System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH));
System.out.println("DATE: " + calendar.get(Calendar.DATE));
System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR));
System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
// 60 days from now
calendar.add(calendar.DATE, 60);
System.out.println("\nSixty days from now");
System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
System.out.println("DATE: " + calendar.get(Calendar.DATE));
System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
}Remember that January is 0!
Take a look at the GregorianCalendar class:
http://java.sun.com/j2se/1.3/docs/api/java/util/GregorianCalendar.html
Hope this helps!
DesQuite -
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
Maybe you are looking for
-
How to get rid of white space when creating a PDF file in dynamics ax 2012
Hello, In Dynamcis AX 2012 we are creating an invoice that is first printed to the screen, but when we convert the invoice to a PDF, white space occurs that our customer cannot have. We opened a ticket with Microsoft with the following scope layout:
-
Deleting & renaming files - is there a shortcut to finder?
I am a recent convert from PC to Mac. So far so good. However, one thing starts to drive me up the wall which is deleting/renaming files in programs such as photoshop, word, excel etc.etc. As far as I can tell, this is only possible in the finder men
-
Why is the number "1" when setting up the dial fat thickness did not change the font? Is it possible to adjust the font in the thick klavioture typing?
-
ABAP Code Inspector & Security
All: I am currently looking into the Code Inspector that is built into SAP that allows developers to run test/checks on their code related to performance, syntax, and as noted "security". I am trying to track down what exactly the "security" is being
-
Examples on Web Dynpro Java ? For more practice purpose
Hi EP experts I want more examples on Web Dynpro Java for practice purpose My project next phase is on full webdynpro Pl...provide me more worked examples but in SDN i found very few regards kiran LVS