Getting total days in month
please tell me how to get total days in month by calendar:
suppose i pass these parameters in calendar:=
Calendar c1=new GregorianCalendar(2005,1,6);
means it is feb 2005
now i want to find the No of days in current month:
it should give 28 .
please tell how to get.progarmatically i know.
i want API
Hi,
I don't know if you got it working or not, but I was looking for the same thing and I found the following at this address
http://javaalmanac.com/egs/java.util/GetDaysInMonth.html
// Create a calendar object of the desired month
Calendar cal = new GregorianCalendar(1999, Calendar.FEBRUARY, 1);
// Get the number of days in that month
int days = cal.getActualMaximum(Calendar.DAY_OF_MONTH); // 28
// Try month in a leap year
cal = new GregorianCalendar(2000, Calendar.FEBRUARY, 1);
days = cal.getActualMaximum(Calendar.DAY_OF_MONTH); // 29
Similar Messages
-
Customer Exit to get last day of month from Year/month
Hi Experts,
I need to create a customer exit to get the last day of month from Cal Year month input variable.
Examples
1)
User input period: 12.2008
I need from the customer exit: 31.12.2008
2)
User input period: 02.2009
I need from the customer exit: 28.02.2009
Can someone help me with the ABAP code to achieve this with a customer exit?
Help will be appreciated.Hi,
Please use the following code,
Second one is the suitable solution for you, I can understand that, if it leafe year then you have the problem so use the secon one.
First one is using Period i.e. 010.2008 (December 2008).
Secodn one is based on Date/Month.
Note: Insted of SY-DATUm, you give your variable name
*******To get the Last day of the Fy Period entered by User in ZFYP***
WHEN 'ZLDAY_FI'.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZFYP'.
zbdatj = loc_var_range-low+0(4).
zbuper = loc_var_range-low+4(3).
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = zbdatj
i_periv = 'V3'
i_poper = zbuper
IMPORTING
e_date = zzdate.
CLEAR: l_s_range.
l_s_range-low = zzdate.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDLOOP.
Note: in the below code I given SY-DATUM, so you change to your Month Variable like using
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'XXXX'.
** Last Day of Current Calendar month
zzdate = sy-datum.
CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'
EXPORTING
iv_date = zzdate
IMPORTING
ev_days = znum.
CLEAR: l_s_range.
l_s_range-low+6(2) = znum.
l_s_range-low+0(4) = sy-datum+0(4).
l_s_range-low+4(2) = sy-datum+4(2).
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
Thanks
Reddy
Edited by: Surendra Reddy on Jan 27, 2009 2:47 PM
Edited by: Surendra Reddy on Jan 28, 2009 6:12 AM -
Dynamic variable to get last day of month
Hi all,
I have created one report where in YTD is calculated based on stsyem date. NOw in this report the cal month is in row thus displaying data month wise. But i need one key figure which giving the last day vaue of every month that are displayed in YTD i.e this is based on cal day. Thus the report layout is as follows:
if report is run in mar 2007 then it should display:
For calmonth key figure due amount
For Jan 07 this should show due value on last day of jan 07 (i.e 31st jan 07)
for Feb 07 this should show due value on last day of feb 07 (i.e 28th feb 07)
for Mar 07 this should show due value on last day of mar 07 (i.e 31st mar 07)
customer exit variable can give me only one value at a time. How can I make it dynamic to take last day value of every month as per cal month. Could anybody explain me if worked on any such issue.
If there is some how to paper kindly mail me at my email Id : [email protected]
thanks in advance
Regards,
WrushaliHi,
U can use FM : SLS_MISC_GET_LAST_DAY_OF_MONTH to get the last day of the month by passing the date/current date.
Thanks,
Debasish -
Get working day of month for specific date
Hi,
I need to get the working day of a month for a specific date. For example: Which working day is the 15th of september 2005...
Is there any function module, I could use?
Cheers ArneHI arne,
1. DATE_CHECK_WORKINGDAY
This is the FM.
2. Along with that u will have to use some logic.
3. Just copy paste in new program
(it will help in the logic)
<b>It will list out
all the working days
between two given dates</b>
REPORT abc.
data : num type i.
parameters : frdate type sy-datum default '20051216'.
parameters : todate type sy-datum default '20051221'.
perform getinfo using frdate todate changing num.
break-point.
*& Form getinfo
text
FORM getinfo USING fromdate todate CHANGING numofdays type i.
DATA : d TYPE sy-datum.
d = fromdate - 1.
DO.
d = d + 1.
IF d > todate.
EXIT.
endif.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
EXPORTING
date = d
factory_calendar_id = '01'
message_type = 'I'
EXCEPTIONS
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
factory_calendar_not_found = 5
message_type_invalid = 6
OTHERS = 7.
IF sy-subrc = 0.
numofdays = numofdays + 1.
write :/ d.
ENDIF.
ENDDO.
ENDFORM. "getinfo
regards,
amit m. -
How to get Current day and month value in Stk applets
Friends please provide me the hint to get the Current Value of month and date from the Mobile equipment(ME).
please send feedback to [email protected]Use "PROVIDE LOCAL INFORMATION" command as per GSM 11.14. This however queries the handset date and time, and hence depends on the handset clock (which may not always be reliable).
-
Getting days of month excluding Sundays
i am using this query t calculate total days in a month but what i want is to select total days in month excluding sundays. I want total days in month which should not include Sundays.
Query:
select day(EOMonth(GETUTCDATE())) as TotalDaysBest thing for calculations like this is to have a calendar table in your database with required fields like date,day,year etc. then its just a matter of taking count from table by filtering on date range and checking for day values to exclude weekends etc
Or you can create logic on the fly and use it like below
DECLARE @Month int = 4,@Year int=2013
DECLARE @StartDt datetime,@EndDt datetime
SELECT @StartDt=DATEADD(mm,(@Year-1900)*12 +( @Month-1),0),
@EndDt = DATEADD(mm,(@Year-1900)*12 +( @Month),0)-1
SELECT SUM(CASE WHEN Day='Sunday' THEN 0 ELSE 1 END) AS DayCount
FROM dbo.CalendarTable('2010-01-01','2010-02-28',0,0)
CalendarTable can be found here
http://visakhm.blogspot.in/2010/02/generating-calendar-table.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to get total number of days
Hi All,
how to get total number of days , for example if month eq 05 then need to get total number of days until MAY 31.
and how to get total number of days in a month.
Thank You,,
Sriii..Hi Sridhar,
Pls Try to search before posting general questions.
Try this,
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = p_lv_date1
i_datum_von = p_lv_date2
IMPORTING
e_tage = p_e_date_difference
EXCEPTIONS
days_method_not_defined = 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.
Regards,
Sunil kairam. -
How to get total number of days in current Fiscal period/year
Hi,
I need to get total number of days in current Fiscal period/year (current month) and assign it to an infoobject. I need a routine for this. Is there any function module to get this.If possible pls paste the ABAP code also for this task. Thanks in advancehere is the FM:
LAST_DAY_IN_PERIOD_GET
KJ!!! -
Adding reminders to my calendar items is no longer an option after the software upgrade. I also can't get to day and week view, only month view. What's a possible solution? I'm using Andriod version 4.4.2 with kernal 3.4.0.
@MaloneTP
Thanks for keeping me updated! Do you see the screen options displayed in the following link: http://bit.ly/T2koBL for changing the calendar view options in Kies Air? Also, let me know if you're able to add a Reminder by following these steps: http://bit.ly/T2l9dY. Keep me posted. Thanks!
AnthonyTa_VZW
Follow us on Twitter @VZWSupport -
hi ,
is there an existing date funtion to get last day of the month ?
pls advise
else
i'll try to add_month + 1 to current month and format to the first day and minus 1 day from that new month
tks & rdgslast_day function
<br>
jeneesh -
How to get Last Day of a Previous Month
Hi all,
I need to get Last Day of the Previous Month. I am able to get Current Month Last Day using Calendar.getActualMaximum(Calendar.DATE)
But I need previous Month's Last Day.
Thanks
Vamshi.Thanks all....
I have been trying the same and could get it.....
here is the code for that....
SimpleDateFormat simpleDate = new SimpleDateFormat("MM/dd/yyyy");
Calendar calendar = Calendar.getInstance();
month = calendar.get(Calendar.MONTH);
//year = calendar.get(Calendar.YEAR);
calendar.set(Calendar.MONTH, month-1);
calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE));
//lastDayOfMonth = calendar.getActualMaximum(Calendar.DATE);
System.out.Println("Previous Month End Date is :: " + simpleDate.format(calendar.getTime()));
this works....
thanks for ur replys.... -
Yesterday Adobe Helpdesk gave me a link to manually update my monthly paid for Photoshop CC and now I am getting 00 day trial version expiration warnings, but I paid already for 5 months. How fix this today?
ps: on Thursday there was a automatic windows 8.1 update before shutting down the pc and in friday the photoshop CC monthly paid for since huly 19, did not download the available update. Via helpdesk I got a link to manually update the photoshop CC but today I get a warning that the photoshop CC has 00 days left in trail....whereas I have been paying and using it for 5 months already and helpdesk chat is closed today on saturday.
-
Getting Number of days full month in a selected period
Now I want to know the Total number days full months in a selected time period.
select period 1/02/2014 to 15/03/2014 ->28+31=59
count
(Descendants(
[Время].[Год-Месяц-День].CurrentMember,
[Время].[Год-Месяц-День].[Дата])) ->YMD-> 2014-365, 02-28,03-31
How to achieve aggregation of the year
59 days?VBA!DATEDIFF("d",[Time].[Y-M-D].CurrentMember,[Time].[Y-M-D].[date].membervalue)
Does not work, gives an error
CellOrdinal 0
VALUE Error Number Query (3,
1) Function MEMBERVALUE waits for
argument 1 expression element.
Expression levels were used.
Query (1, 32) Runtime Error managed stored
procedures DATEDIFF: Microsoft :: AnalysisServices :: AdomdServer :: AdomdException.
FORMATTED_VALUE Error Number Query (3, 1)
function waits for the argument MEMBERVALUE
1 expression element. Expression
levels were used. Query (1, 32) Runtime Error
managed stored procedures DATEDIFF: Microsoft :: AnalysisServices :: AdomdServer :: AdomdException.
DATEDIFF used VBA function? -
Getting the day of lst of the month
Hi, how to get the day (sun, mon,......) of every lst of every month. I can get the current day using calendar.get(Calendar.DAY_OF_WEEK). This will return an int indicating the day.
If today is wed(5th Feb 2003), it will return int 4.
How do I get the day for the lst of every month?
ThanksYou can give this a try:
Calendar cal = new GregorianCalendar(); // Get today's date, or pass in your own date
cal.set(Calendar.DATE, 1); // Set the date to the 1st of the month
dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); // Get the day -
How to get first day of the month by the given date?
Now, is there function in CRM system that can get the first day of the month ?
for example:
input date is 2007/12/12, then return 2007/12/01 (the first day of month).
Thank you~Hi ping,
data: w_date type sy-datum ,
w_temp(2) type c.
w_date = '20071212'.
w_temp = w_date+6(2).
w_temp = w_temp - 1.
w_date = w_date - w_temp.
write / w_date.
Plz Reward if useful,
Mahi.
Maybe you are looking for
-
Workflow. Latest workflow operation has been queued
Good day, I have sequential workflow which Is started after item created in list. Sometimes, after start of workflow in status I can see note: Due to heavy load, the latest workflow operation has been queued. It will attempt to resume at a later time
-
BAPI_SALESORDER_CREATEFROMDAT2 for creating sales orders with configurable
Hi All, I want to create sales order with a material which in turn triggers a configurable network order. I am using the following BAPI : BAPI_SALESORDER_CREATEFROMDAT2. After reading the "[Variant Configuration (LO-VC)|http://help.sap.com/printdocu/
-
How can we handle Exception Branch in BPM effectively
Hi, I want to capture errors occurred in PM during runtime by using special "Exception Branch". For example If i define exception branch for one black then any step within that block thrown error then automatically it calls that corresponding excepti
-
Hello, I have created a query on an info provider and now I want to change the description as well as the technical name of this query. Is there a way to achievce this? I know I can copy the query rename there. But is there any other way to do this t
-
FBA users in a role not able to log in.
Hi I am in the process of doing a SP 2010 to 2013 upgrade for a number of extranet sites that use FBA. Both environments have now been configured to use the same membership services database. I have done a database attached upgrade and all looked oka