Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners How to calculate number of weeks in a specified month
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Pushpa Sheela
How to calculate number of weeks in a specified month
1 Answer(s)      4 years and a month ago
Posted in : Java Beginners


I am create one program that contain three combo box. 1.cmbyear 2.cmbmonth 3.cmbweek

i am select year and month. then automatically calculate number of weeks in a specified month for the year.

for example if i choose year in 2008 and month in october then display number of weeks in cmbweek combo box. ex

1week 2week 3week 4week 5week

Please help me as soon as possible.


Advertisement
View Answers

April 29, 2011 at 8:33 PM


package com.test.dateutil;

import java.util.Calendar; /** * Code To calculate number of Days in a Month and number of weeks in a month * @author Lalit * */ public class GetDaysInMonth { public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); int year = 1998; int month = Calendar.FEBRUARY; int date = 1; calendar.set(year, month, date); int numOfDaysInMonth = calendar.getActualMaximum(Calendar.DAYOFMONTH); int numOfWeeksInMonth = calendar.getActualMaximum(Calendar.WEEKOFMONTH); System.out.println("Number of Days In Month: " + numOfDaysInMonth); System.out.println("Number of Weeks In Month: " + numOfWeeksInMonth);

}

}



Related Tutorials/Questions & Answers:
How to calculate number of weeks in a specified month
How to calculate number of weeks in a specified month  I am create... select year and month. then automatically calculate number of weeks in a specified... then display number of weeks in cmbweek combo box. ex 1week 2week 3week 4week
Java get number of Days in Month
Java get number of Days in Month       In this section, you will learn how to obtain the number of days in the specified month. This example sets the year as 2008, month
Advertisements
how to create month wise serial number in java?
how to create month wise serial number in java?  Ex: For 1)January-serial number is 1/001,1/002,1/003 etc
Determining the Number of Days in a Month
Determining the Number of Days in a Month   This section will show the way of counting the number of days of a month in the specified year. Following... of the GregorianCalendar class which create an instance for that. Year and month are specified
Calculate Month Difference in mysql - SQL
Calculate Month Difference in mysql  hi , i am rahul.Can anybody plz help me.i am calculating month difference in mysql5.0 procedure . i have done... of date increasing or decreasing based on month like 31 and 30 .coding
Calculate factorial of a number.
Calculate factorial of a number.  How to calculate factorial of a given number?   import java.io.BufferedReader; import java.io.IOException...("Please Input Any Number"); int num = 0; BufferedReader br = new
PHP convert week number to days or month - PHP
or weeks? I tried but it didn?t work well.. what all I need is 4 weeks = 1 month...PHP convert week number to days or month  Small, simple and easy code that can do following task: 1.Convert Week Numbers to Month 2.Convert Week
Calculate total number of elements remaining in the buffer.
Calculate total number of elements remaining in the buffer. In this tutorial, we will discuss how to calculate total number of elements remaining...)  The allocate() method create a int buffer of specified
Week calculate start from friday
number of weeks for the selected month. example: if i select year in 2010 month...Week calculate start from friday  My problem is to calculate how many weeks have a month. Note that my weeks have to start on Friday! I have three
Javascript calculate number of days between two dates
Javascript calculate number of days between two dates In this tutorial, you will learn how to calculate number of days between two dates.For this, you need.... The desired interval can then be determined by dividing that number
Find number of words begin with the specified character
Count number of words begin with the specified character In this section, you will learn how to count the number of words that begin with the specified... + "-" + count); } } Output: Enter string: Hi How are you
How to calculate days in a year
How to calculate days in a year  Hi, How to calculate no of days in a year? I want a program that calculates no of days in a year by specifying year a parameter. Thanks   Hi, Please check the thread example
How to calculate attending hours?
How to calculate attending hours?  I need to calculate attending hours of a employee in a day in my project to make their monthly salary . By using work starting time and ending time. How should I do it using Date class? Or any
How to calculate the average in Hibernate?
How to calculate the average in Hibernate?  Hi, I have to calculate the average in Hibernate. How to calculate the average in Hibernate? Thanks   Hi, You can use the project in Hibernate. Here is the example code
How to Addding One Month with PHP ?
How to Addding One Month with PHP ?  Hi, I am very new in this php programming language. Can anybody will guide me how to add 1 month on a specific date on PHP. Please give any example or reference links. Please feel free
how to calculate EMI of the loan
how to calculate EMI of the loan   package carloanapp; import java.io.FileWriter; import java.io.IOException; public class CarLoan { Customer gObjCustomer = null; double gDbRequestedLoanAmount = 0; double
how to calculate the price on the option box
how to calculate the price on the option box  How i calculate the value when i using a option box with 2 option..first option i used for product name... to calculate this value
how to calculate max and min - RUP
how to calculate max and min  hye!i'm a new for the java and i want to ask a question . Could anyone help me to teach how to calculate the maximum... void main(String args[]) { // Method for the max number among the pair
Hi..How to Display Days by month - Java Beginners
Hi..How to Display Days by month  Hi Friend.... I have a doubt on date Program... How to display the Number of days..it should display Separate .Month by Month For Ex.. INPUT: ---------------- Year Month Day 2006 12
How to calculate area of rectangle
How to Calculate Area of Rectangle       In this section we will learn how to calculate area... explain the static method how to display the rectangle values. First of all we have
how to calculate the employee tax - JSP-Servlet
how to calculate the employee tax  How to calculate the employee tax.Can u please send to me calculation tables
How to calculate sum of HH:MM:SS Format?
How to calculate sum of HH:MM:SS Format?  how to calculate sum of HH:MM:SS? for example: 10:25:36+26:50:56 calculate sum of these values
Write a program to calculate factorial of any given number
program to calculate factorial of any given number. First of all define a class... Factorial Examples - Java Factorial Example to calculate factorial of any given number      
how can you calculate you your age in daies??
how can you calculate you your age in daies??  **hi, I am beginner in java! can any one help me to write programm to calculate age in daies...(); System.out.print("Enter month(in number) of your date of birth: "); int month
How to calculate area of triangle
.style1 { margin-right: 0px; } How to Calculate...; In this section we will learn how to calculate area of triangle. We... in this program we will fine the how to the display massage the area
How to display jfreechart at specified place in jsp
How to display jfreechart at specified place in jsp  I have a jsp page where i need to display the chart at specified position .But With the following codes chart is getting loaded as png image and all other css design elements
how to calculate max and min in the loop - Java Beginners
how to calculate max and min in the loop  thanks coz giving me... static void main(String[] args) throws IOException { // Max Number to be inputted System.out.println("Enter Number to be input: "); BufferedReader
How to get month name from date(like-25/06/2012) using java?
How to get month name from date(like-25/06/2012) using java?  How to get month name from date(like-25/06/2012) using java
how to show x axis values of timeline chart in jfreechart with particular month.
how to show x axis values of timeline chart in jfreechart with particular month.  my x-axix timeline having day of 1 month and days shows me only differently and 1 month. I want month attached with days
how to display(update) current date and month in select box on selecting the year.
how to display(update) current date and month in select box on selecting the year.  how to display(update) current date and month in select box on selecting the year
how to find last day 0f any given month in mysql?
how to find last day 0f any given month in mysql?  how to find last day of any given month in mysql?   Hi Friend, Here is required code: DECLARE @dtDate DATETIME SET @dtDate = '8/18/2007' SELECT DATEADD(s,-1,DATEADD
Advertisements
 

 

 

DMCA.com