Calculate the number of days in a year excluding Saturday and Sunday
Hi All,
I need to get the number of days in a year excluding Saturday and Sunday for HR module and then subtract the public holidays.
Can some let me know how this needs to be done while loading data from one infocube to another.
Is there any Function module for the same so that i can write any start routines.
And also is there any table available for Tcode-SCAL with which i can write any start routines.
Kindly help me as soon as possible.
Regards,
Kumar
Hi Harish
Refer to the screenshot for Import and Export parameters
Code
FUNCTION ZBI_FM_GET_HOLIDAYS .
*"*"Local Interface:
*" IMPORTING
*" VALUE(DATE_FROM) TYPE SCAL-DATE DEFAULT SY-DATUM
*" VALUE(DATE_TO) TYPE SCAL-DATE DEFAULT SY-DATUM
*" VALUE(FACT_CAL) TYPE SCAL-FCALID DEFAULT SPACE
*" VALUE(ONLYFACT_DAYS) TYPE CHAR1 OPTIONAL
*" EXPORTING
*" REFERENCE(HOLIDAYS) TYPE I
*" TABLES
*" DAY_ATTRIBUTES STRUCTURE CASDAYATTR
*" EXCEPTIONS
*" FACTORY_CALENDAR_NOT_FOUND
*" HOLIDAY_CALENDAR_NOT_FOUND
*" DATE_HAS_INVALID_FORMAT
*" DATE_INCONSISTENCY
DATA: LT_DAY_ATTRIBUTES TYPE TABLE OF CASDAYATTR WITH HEADER LINE.
DATA: LV_LINES TYPE SY-SUBRC.
DATA: DATE1 LIKE DATE_FROM,
DATE2 LIKE DATE_TO.
*if from date is gt to date then interchange the dates and multiply the result with -1.
IF DATE_FROM GT DATE_TO.
DATE2 = DATE_FROM.
DATE1 = DATE_TO.
ELSE.
DATE1 = DATE_FROM.
DATE2 = DATE_TO.
ENDIF.
CALL FUNCTION 'DAY_ATTRIBUTES_GET'
EXPORTING
FACTORY_CALENDAR = FACT_CAL
* HOLIDAY_CALENDAR = ' '
DATE_FROM = DATE1
DATE_TO = DATE2
LANGUAGE = SY-LANGU
* IMPORTING
* YEAR_OF_VALID_FROM =
* YEAR_OF_VALID_TO =
* RETURNCODE =
TABLES
DAY_ATTRIBUTES = LT_DAY_ATTRIBUTES
EXCEPTIONS
FACTORY_CALENDAR_NOT_FOUND = 1
HOLIDAY_CALENDAR_NOT_FOUND = 2
DATE_HAS_INVALID_FORMAT = 3
DATE_INCONSISTENCY = 4
OTHERS = 5 .
IF SY-SUBRC = 0.
IF ONLYFACT_DAYS = 'X'.
DELETE LT_DAY_ATTRIBUTES WHERE FREEDAY EQ SPACE.
ELSE.
DELETE LT_DAY_ATTRIBUTES WHERE WEEKDAY LT 6.
ENDIF.
DESCRIBE TABLE LT_DAY_ATTRIBUTES LINES LV_LINES.
HOLIDAYS = LV_LINES.
* IF DATE_FROM GT DATE_TO.
* HOLIDAYS = HOLIDAYS * -1.
* ENDIF.
ELSEIF SY-SUBRC = 1.
RAISE FACTORY_CALENDAR_NOT_FOUND.
ELSEIF SY-SUBRC = 2.
RAISE HOLIDAY_CALENDAR_NOT_FOUND.
ELSEIF SY-SUBRC = 3.
RAISE DATE_HAS_INVALID_FORMAT.
ELSEIF SY-SUBRC = 4.
RAISE DATE_INCONSISTENCY.
ENDIF.
ENDFUNCTION.
Similar Messages
-
Day between two dates excluding Saturday and Sunday
Hi,
I have the Requirement like : there are two inputs in query 1)startdate and 2)end date when end user enter the start date and end date the sql query has to retrive the number of days between given start and end dates, and it should be retrivied with two condition 1)all sundays between the above dates excluded 2)second and fourth Saturday of the month in between the start and end dates has to be excluded .
example start date:01-may-09
end date: 16-may-09
expected output:13Balaji.M wrote:
Hope this will be helpful for you.
SELECT dates,
TO_CHAR(dates, 'D'),
TO_CHAR(dates, 'DAY'),
TO_CHAR(inner.dates, 'W')
FROM (SELECT TO_DATE('01-may-09') + LEVEL - 1 dates
FROM DUAL
CONNECT BY LEVEL <= (TO_DATE('16-may-09') - TO_DATE('01-may-09')) + 1) inner
WHERE ( ( TO_CHAR(inner.dates, 'D') = 7
AND TO_CHAR(inner.dates, 'W') NOT IN(2, 4)
OR TO_CHAR(inner.dates, 'D') not in (1,7)
You can replace the start date (two place) and end date (one place) by variables and check.Of course we have to be aware of local NLS settings:
SQL> SELECT dates,
2 TO_CHAR(dates, 'D'),
3 TO_CHAR(dates, 'DAY'),
4 TO_CHAR(inner.dates, 'W')
5 FROM (SELECT TO_DATE('01-may-09') + LEVEL - 1 dates
6 FROM DUAL
7 CONNECT BY LEVEL <= (TO_DATE('16-may-09') - TO_DATE('01-may-09')) + 1) inner
8 WHERE ( ( TO_CHAR(inner.dates, 'D') = 7
9 AND TO_CHAR(inner.dates, 'W') NOT IN(2, 4)
10 )
11 OR TO_CHAR(inner.dates, 'D') not in (1,7)
12 );
DATES T TO_CHAR(D T
01-MAY-09 5 FRIDAY 1
02-MAY-09 6 SATURDAY 1
03-MAY-09 7 SUNDAY 1
05-MAY-09 2 TUESDAY 1
06-MAY-09 3 WEDNESDAY 1
07-MAY-09 4 THURSDAY 1
08-MAY-09 5 FRIDAY 2
09-MAY-09 6 SATURDAY 2
12-MAY-09 2 TUESDAY 2
13-MAY-09 3 WEDNESDAY 2
14-MAY-09 4 THURSDAY 2
15-MAY-09 5 FRIDAY 3
16-MAY-09 6 SATURDAY 3
13 rows selected.
SQL>Day 1 on my local database is Monday, not Sunday. -
Number of a day of an year without saturday and sunday
Hi,
How can I get the number of the day of an year?
How can I remove, from this number the saturday and the sunday? Should I check day by day?
Thanks, bye bye.Or you can function NEXT_DAY, some math and table dual:
to_char(to_date(6,'j'),'Day') is NLS independent way of representing Sunday and to_char(to_date(5,'j'),'Day') is NLS independent way of representing Saturday.
NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day')) is first sunday >= start_date. NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) is last Sunday <= end_date. Therefore:
(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 + 1 is number of Sunday's between start_date and end_date. Same way:
(NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 + 1 As a result, number of weekdays between start_date and end_date is:
end_date - start_date + 1 -((NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 + 1 +
(NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 + 1) or
end_date - start_date - 1 -(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 -
(NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 or:
SELECT end_date - start_date - 1 -(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) /
7 - (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7
FROM DUAL; Now:
WITH t AS (
SELECT to_char(to_date(6,'j'),'Day') sunday,
to_char(to_date(5,'j'),'Day') saturday,
DATE '2009-01-01' start_date,
DATE '2009-12-31' end_date
FROM dual
SELECT end_date - start_date - 1 -(NEXT_DAY(end_date - 7,sunday) - NEXT_DAY(DATE '2009-01-01' - 1,sunday)) /
7 - (NEXT_DAY(end_date - 7,saturday) - NEXT_DAY(start_date - 1,saturday)) / 7
FROM t
END_DATE-DATE'2009-01-01'-1-(NEXT_DAY(END_DATE-7,SUNDAY)-NEXT_DAY(DATE'2009-01-0
261
SQL> SY. -
I wanted to know how do you calculate the number of days between two dates
i wanted to know how do you calculate the number of days between two dates in java ? i get both the dates from the database. i guess there are many issues like leap year and Febuary having diff no of months ..etc.
thanks..
I solve my problem as
public class MyExample {
public static void main(String a[]) {
String stdate = "2009-03-01";
java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
java.sql.Date preDate = java.sql.Date.valueOf(stdate);
System.out.println(currentDate);
System.out.println(preDate);
// int dateCom = preDate.compareTo(currentDate);
// System.out.println(dateCom);
long diff = currentDate.getTime() - preDate.getTime();
int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
System.out.println(days);
} -
I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
Attachments:
D5.7_1.vi 8 KBI just had a little fun with the Time Record...
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
D5.7_1_BD.png 19 KB -
How to calculate the number of days worked for a given period
I need to calculate the number of days worked by contractor employees for a time period to be entered by a user. I am building a query on an infoset which contains employee information including contract start date and contract end date for the employee.
Ideally I'd like the user to enter the time period which should be reported on e.g. 01.08.2009 to 31.08.2009
The report should then identify all the contractor employees which were working during this period and to work out how many days they worked during this period. Obviously the contract start and end dates could fall both inside and outside the reporting period.
Can this be done and if so, do you have any suggestions as to how to do it?
Thanks.hi
So here you will first have to load the master data table employee in one internal table and read this table with the variables entries.
Your code in the reporting exit should look like that.
bye
data : wa_employee type /bi0/pemployee.
When 'ZDATE1'
if i_step = 2.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE2'.
clear l_s_range.
clear wa_employee
1- select the entries from table employees
select single employee dateto datefrom
from /bi0/pemployee
into corresponding fields of wa_employee
where dateto le loc_var_range-low
and datefrom ge loc_var_range-high.
if sy-subrc eq 0.
CALL FUNCTION 'FIMA_DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_von = wa_employee-datefrom
i_kz_ult_von = 'X'
i_datum_bis = wa_employee-dateto
i_kz_ult_bis = 'X'
i_szbmeth = '1'
IMPORTING
e_tage = no_days.
l_s_range-low = no_days.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDIF.
endloop.
ENDIF.
Boujema -
How to count days between two dates excluding saterady and sunday
Hi all
iam working on oracle sql/plsql.
In my application , i need to caliculate leave days between two dates excluding saterady and sunday
Please tell me the solution if any one knows
thanks in advance ,
baluMore modern version:
WITH date_tab AS
(SELECT TO_DATE ('&from_date', 'dd-MON-yyyy')
+ LEVEL
- 1 business_date
FROM DUAL
CONNECT BY LEVEL <=
TO_DATE ('&to_date', 'dd-MON-yyyy')
- TO_DATE ('&from_date', 'dd-MON-yyyy')
+ 1)
SELECT business_date
FROM date_tab
WHERE TO_CHAR (business_date, 'DY') NOT IN ('SAT', 'SUN');Thank you,
Tony Miller
Webster, TX
Never Surrender Dreams!
JMS
If this question is answered, please mark the thread as closed and assign points where earned.. -
Calculate the number of days in a month
I need to do a calculation in my query based upon the number of days in the month. The report is broken down by cal year / month.
Is there an easy way of identifying these values in the query?
Regards.Hi,
This can be done by writing an user exit code to determine the number of days in the month.
Sample Code :
<
CHECK i_step = 2.
READ TABLE i_t_var_range WITH KEY vnam = 'XXXX'
INTO loc_var_range.
IF sy-subrc EQ 0.
beg_date(6) = loc_var_range-low(6).
end_date(6) = loc_var_range-low(6).
beg_date+6(2) = '01'.
end_date+6(2) = '01'.
ADD 1 TO end_date+4(2).
IF end_date+4(2) = '13'.
end_date+4(2) = '01'.
ADD 1 TO end_date(4).
ENDIF.
no_days = end_date - beg_date.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = no_days.
APPEND l_s_range TO e_t_range.
ENDIF.
>
Hope this helps..
Thanks & Regards,
Pradeep -
Create a field routine to calculate the number of days per month
Hi Experts,
I need to create a field routine to count the number of days per month based on 0CALMONTH. Could you give me some inputs on how to do it?
Thanks!Hi,
Create InfoObejct and then insert it in InfoSource/InfoCube/DSO then write simp,e code for that based on your 0CALMONTH values.
You just copy and pas this in SE38 and see the result and implement for your requirements.
REPORT ztest1.
Data: zsydt type sy-datum,
zd(2) type n,
zm(2) type n,
zy(4) type n,
zcmnth TYPE /bi0/oicalmonth,
znds TYPE /osp/dt_day.
zsydt = sy-datum.
zd = '01'.
zm = zsydt+4(2).
zy = zsydt+0(4).
CONCATENATE zy zm zd INTO zsydt.
CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'
EXPORTING
iv_date = zsydt
IMPORTING
ev_days = znds. "No.of days in month.
write:/ zd.
write:/ zm.
write:/ zy.
write:/ zsydt.
write:/ znds.
Thanks
Reddy -
Add working days to a date excluding weekends and holidays
Hi there,
I need to write a function that will take a specified date and number of days to add as input parameters, and return the working day based on the number of days to add parameter, excluding weekends and any holidays held in a holiday table.
Here is my function so far -
CREATE OR REPLACE FUNCTION f_add_work_days(pd_date IN DATE
,pn_add_days IN PLS_INTEGER) RETURN DATE IS
pd_in_date DATE := pd_date;
ld_next_holiday DATE;
ln_days_left PLS_INTEGER := pn_add_days;
CURSOR cu_holiday(pn_date IN ge740.holdte%TYPE) IS
SELECT pck_utility.f_dtcnv(g.holdte)
FROM ge740 g
WHERE g.holdte >= pn_date
AND g.maint <> 'D'
ORDER BY g.holdte ASC;
BEGIN
OPEN cu_holiday(pck_utility.f_dtcnv(pd_in_date));
FETCH cu_holiday
INTO ld_next_holiday;
CLOSE cu_holiday;
LOOP
IF ln_days_left = 0 THEN
EXIT;
END IF;
pd_in_date := pd_in_date + 1;
IF pd_in_date > ld_next_holiday THEN
OPEN cu_holiday(pck_utility.f_dtcnv(pd_in_date));
FETCH cu_holiday
INTO ld_next_holiday;
CLOSE cu_holiday;
END IF;
CASE
WHEN TO_CHAR(pd_in_date
,'fmDAY') = 'SATURDAY' THEN
pd_in_date := pd_in_date + 2;
ln_days_left := ln_days_left - 1;
WHEN TO_CHAR(pd_in_date
,'fmDAY') = 'SUNDAY' THEN
pd_in_date := pd_in_date + 1;
ln_days_left := ln_days_left - 1;
WHEN pd_in_date = ld_next_holiday THEN
pd_in_date := pd_in_date + 1;
ln_days_left := ln_days_left - 1;
ELSE
ln_days_left := ln_days_left - 1;
END CASE;
END LOOP;
RETURN(pd_in_date);
END f_add_work_days;
I think there is something wrong/missing in the logic as I can't get it to cater for say a double bank holiday(25/26th Dec - if the input parameters are 24/12/2007 and 2, which should return the 28th but returns the 26th!!).
I'm relatively new to PL/SQL and Oracle, so any help, advice, ideas would be greatly appreciated!
thanks in advancesmth like
SQL> with holidays as (select to_date('10.06.2007','dd.mm.yyyy') h_dt from dual),
2 par as (select to_date('08.06.2007','dd.mm.yyyy') dt, 2 add_days from dual)
3 --
4 select min(dt) needed_date
5 from (select p.*,
6 h.*,
7 mod(to_char(dt, 'j'), 7),
8 sum(decode(mod(to_char(dt, 'j'), 7), 5, 0, 6, 0, 1)+--get rid of sat and sun
9 nvl2(h_dt, -1, 0)--check if the day is holiday
10 ) over(order by dt) s
11 from (select dt + level dt, add_days
12 from par
13 connect by level <= 100) p,
14 holidays h
15 where h_dt(+) = dt
16 order by 1)
17 where add_days = s
18 /
NEEDED_DATE
13.06.2007
SQL> ?
Message was edited by:
Volder
PS What Oracle version are you on? -
Determine the number of days in a False period in a Temporal Boolean
Hi all,
I need to determiine the number of days based on a condition that lies on the gaps between the periods.
My input consists of multiple periods. The length of the gap is the condition to determine the start date for summation. However, there can be multimple gaps between my instances that satisfy this condition and I need the last one that satisfies it.
For example:
period 1: 1-1-1990 until 31-12-1992
period 2: 1-1-1994 until 31-12-1996
period 3: 1-1-1998 until 31-12-1999
period 4: 1-6-2000 until 31-12-2009
The condition for the start date is the last gap greater than 1 year. In this example, the start date should be the start date of period 3: 1-1-1998, because this is the period after the last gap >= 1 year. Period 2 also has a previous gap of >= 1 year, but this period should NOT be selected.
My first idea was to use a TBR function: to determine relevant periods (based on the gaps before and after), calculate the amount of days per relevant period and add those up. However, if I want to do that I need to calculate the number of days in the gaps and I don't see how to do that, since I cannot determine a day difference across periods (end date period 1 until start date period 2).
Any help/ other solution ideas?
Kind regards, ElsThis was an interesting puzzle which you can solve from a couple of different angles.
Firstly, you can use inferred relationships to infer a relationship "the following periods" (ie. the periods that follow the current one). My rules looked like this:
the period (the other period) is a member of the following periods if
the other period start date > the period start date
the period’s next start date = InstanceMinimum(the following periods, the period start date)From here it should be easy to see if there was a gap of more than a year, and find the most recent period after a year-long gap. Of course you need to deal with the situation of the last period, when there is no 'next' period, presumably you would use the date of assessment in that case, but I'll leave that as an exercise for the reader.
A completely different way of doing it is to use the TemporalConsecutiveDays function to find a date where a gap of 365 days exists, then select periods in which there is a gap immediately before the start of that period. Here are some rules that :
there is a period that applies if
ExistsScope(the periods)
TemporalOnOrAfter(the period start date) and
TemporalOnOrBefore(the period end date)
there is a year-long gap if
TemporalConsecutiveDays(365, 365, there is not a period that applies)
the period starts after a year-long gap if
ValueAt(the period start date, there is a year-long gap)
the start date for calculation = InstanceMaximumIf(the periods, the period start date, the period starts after a year-long gap)Hopefully one of these is suitable for your needs.
cheers,
Steve. -
How to calcuate the number of days
Hi Friends,
can some one help me out .. how to dispaly the number of days depending upon the from and to date selected by the user.
eg :-
there is one self service form.. in which three fields are there, they are 1) From date
2) To date
3) No of days
now my requirement is, user selects from date and to date and i need to calculate the number of days he is selected and display in No of days field. can some one help me out logic for this.
how to retrive from date and to date dynamically to my function.
apart from writing function .. can we use $FLEX$ becoz two dates are valuesets.
seeking for a solution,
thanks in advanceThis doesn't sound like something that will be easy to do.
A few questions:
1) What flexfield are you referring to?
2) What Self Service page?
3) Can the 'No of days' ALWAYS be calculated? Or do you just want to default it so the user can modify it? -
Hello -
I've been tearing my hair out over this problem i'm trying to solve, probably just been staring at it too long which is making it worse -
I have a series of open support tickets which are supposed to be updated on a daily basis, the problem is that they aren't always being updated daily. So, the business wants to know the number of days from when a ticket was last updated and today's
date. I have this basic calculation and it's working fine, however now the business wants to exclude weekends from the calculation. The other problem is that some reps DO go in on weekends and update their tickets, so sometimes there will be updates
made on weekend dates.
To give an example -
Today's date is 2014-02-10 (Monday). A ticket was last updated last Thursday, 2014-01-30. The difference between the two dates is 11, so it's been 11 days since the ticket was last updated. Now, if I exclude Saturdays and Sundays, then
it's actually been 7 days since the ticket was last updated. I'm not sure how to do this in T-SQL.
Now, to further complicate the problem, sometimes a ticket IS updated on a Saturday or Sunday. So, if a ticket was updated on 2014-02-02 (Sunday), then it should be counted. Again i'm not sure how to do this.
What gets me is that this is probably fairly simple and i've just been staring at it too long. In the meantime, can someone offer some guidance?
Thanks!!I've adapted this from a function on my blog. you will need to add set the YourTicketTable to where ever your tickets are stored.
CREATE
FUNCTION [dbo].[CalcWorkDaysBetween](@StartDate
As DateTime,@EndDate
AS DateTime)
RETURNS
INT AS
BEGIN
SET @EndDate
=DATEADD(DAY,1,@EndDate)
DECLARE @Count
AS Int= 0
DECLARE @Date
As Date=@StartDate
WHILE @Date
< @EndDate
BEGIN
IF (DATEPART(WEEKDAY,@Date)IN(1,7)
OR (SELECT
Count(*)
FROM YourTicketTable WHERE TicketDate=@Date)=1)
BEGIN
SELECT @Count = @Count
+ 1
END
SELECT @Date=DATEADD(Day,
1,@Date)
END
RETURN
DATEDIFF(DAY,@StartDate,@EndDate)- @Count
END
Regards, -
FM to get the number of days in Year,month and days by giving number of day
Hi ALL,
This is quit differnt.
I need to give input the 'start date' and the 'number of days' and get the total days from the start date in year,month and day format.
for example.
start date :01.01.2009
number of days as 32
then i should get
years:0
months :1
days :1
Pleas help me out.hi Anusha,
first u pass the date and the days to the following fm you will get the result date....
data:date type sy-datum,
r_date(10) type c.
date = sy-datum.
CALL FUNCTION 'CALCULATE_DATE'
EXPORTING
DAYS = '32'
MONTHS = '0'
START_DATE = date
IMPORTING
RESULT_DATE = r_date
write:/ r_date.
then you need to pass the result date and the date to the following fm to get the required output...
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
date1 = r_date
date2 = date
IMPORTING
years = v_years
months = v_months
days = v_days
EXCEPTIONS
invalid_dates_specified = 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.
here u will get the difference in days, months and year...
i hope u wil get help from this...
regards
Ashu Singh -
How to get the number of days in a month?
hi all
is there any way to get the number of days in a given month with a given year? for instance, if year is 2004 and the month is July or February, how can i get the number of days? thanks.Gee, I don't know ... Maybe this:
Calendar cal = Calendar.newInstance();
cal.set(Calendar.YEAR, 2004);
cal.set(Calendar.MONTH, Calendar.FEBUARY);
System.out.println("max days in month: " + cal.getActualMaximum(Calendar.DAY_OF_MONTH));
Do you not bother reading what people have already posted? Read the API docs on the Calendar class.
Maybe you are looking for
-
Improving speed in a java program
i have a fairly simple content blocking program, it accesses a database, this puts a user profile in an array to compare it against a web page classification. The database used is Oracle and I'm connecting with a JDBC thin client. The web page classi
-
Iphoto 10 not able to download photos from kodak digital camera.
Working fine every time till recently and now the thumbnails have no image, just blank boxes and won't import new photos. error message returned "can't access photo" or similar
-
External isight does not like 10.4.7
I have been trying for two days to get this dam exteral isight via firewire to connect. I have checked all threads and tried all suggestions with no success. I also see I am not alone. There is no file for isight in the extensions folder and when you
-
WD 500Gb HD with Pavilion DV4 series
The hard drive in my Pavilion DV4 has gone bad. The original HD was 250 Gb I purchased a Western Digital Scorpio Blue 320 Gb to replace it. The computer will not recognize the new hard drive. Using the restore disks just gives an "error 100a", an
-
Client System health certificate name issue
Hi, System health certificate is generated using HRA server name for clients system. There is no event log error for this. Can anyone suggest what can be the issue here. Thanks, Sridhar Sridhar