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

 
 


Pushpa Sheela
How to calculate number of weeks in a specified month
1 Answer(s)      2 years and 7 months 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.

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 Pages:
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
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
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 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
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
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
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
Programming: Weeks and Days
Java NotesProgramming: Weeks and Days Name _______________________________ Write a program to read in a number of days. It should then display the number of weeks and days that that represents. You can solve this using integer
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
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 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
calculate milliseconds to hh mm ss
calculate milliseconds to hh mm ss  how to calculate milliseconds to hh mm ss ? Actually i wanted to calculate week days and hours from milliseconds... weeks = (days / 7) | 0; days -= weeks * 7
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
Calculate sum and Average in java
Calculate sum and Average in java  How to calculate sum and average in java program?   Example:- import java.io.BufferedReader; import... the sum by the total number of numbers, we have determined the average of numbers
Find Day of Month
Find Day of Month       This example explores how to find the day of a month and the day... the week number within the current month. DAY_OF_WEEK: This field gets and set
calculate difference between two dates
calculate difference between two dates  hi, I was actually working on to calculate the number of days between two dates of dd/mm/yyyy format using javascript. can anyone suggest me how to work it outin calculating
Generate shuffling in the specified list
", "Komal"}; // create list for the specified array of employee. List... to generate number randomly. Random num = new Random(); // shuffle and print the list according to the generated random number
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
MySQL add month
MySQL add month In this section we will learn how to add 1 month, 2 month... example shows how to add 1 month to a date object: SELECT DATE_ADD('2008-12-15', INTERVAL 1 MONTH) Output: 2009-01-15 Following example show how
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
Find Month name using DateFormatSymbols class.
will learn how to find the month name using DateFormatSymbols class. The class... this information. Here we are going to find the month name based on the number...)); } } Output: Enter number between 1 and 12: 7 Month is: July
Java Get Month from Date
Java Get Month from Date       In the given example, you will see how to retrieve the current month from the current date using Java Application Language.  You can see
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
Calculate factorial Using Recursion
through this example you will be understand how you can calculate the factorial... to calculate the factorial. The number we have entered in the html page...Calculate factorial Using Recursion  
calculate average
calculate average   Design and write a java program to determine all... to the original number. abc = a^3 + b^3 + C^3 ( NOTE 407 is one of them) 2.Design and write a program and calculate your final average in this course. The details
Calculate the Sum of three Numbers
how to calculate three integer number . First of all define class name "... . In this section you will learn how to calculate the sum of three numbers by using three... Calculate the Sum of Three Numbers   
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
JavaScript calculate age from date of birth
JavaScript calculate age from date of birth  How to calculate age... specified date in place of current date to count age. getFullYear() is used here to get year of specified date
VoIP Number
each per month. The "universal number" feature, which allows subscribers... VoIP Number VoIP Numbers With a VoIPtalk Incoming number, callers can reach you by calling a UK number no matter where you are, Simply plug
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
the Action Mapping specified
the Action Mapping specified  How is the Action Mapping specified
How to make auto number? - JSP-Servlet
How to make auto number?  Dear, my friend... I really need your help.... I want to ask you, how to make auto number in mysql database... number 08 = month (august) 09 = year If system of date change
Calculate Age using current date and date of birth
Calculate Age using current date and date of birth In this section you will learn how to calculate the age. For this purpose, through the code, we have prompted the user to enter current date and date of birth in a specified format. Now
calculate reward points.
calculate reward points.  How to calculate reward points in a multiplex automation system
Find in Array - Calculate Occurrences of Elements in Array
Find in Array - Calculate Occurrences of Elements in Array       This section illustrates you how to calculate occurrences of elements in an array. Occurrences means, the how many
How create auto number? - JSP-Servlet
How create auto number?  Dear, my friend... I really need your help.... I want to ask you, how to make auto number in mysql database... number 08 = month (august) 09 = year If system of date change to be next
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
Calculate sum of even and odd numbers in Java
Calculate sum of even and odd numbers In this section, you will learn how to read the file that contains even and odd numbers and calculate their sum... numbers from the file and then calculate their sum. Here is the code
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
Convert Number to Roman Number Using Java
Java Convert Number to Roman Numerals In this section, you will learn how... and the method convertIntegerToRoman(int n) convert the specified number into roman if the specified number is within the specified range(1-4999).  Here
C calculate sum of first and last element of array
C calculate sum of first and last element of array In this section, you will learn how to calculate sum of first and last element from the array of five... enters the number. Then using the index of the array, we have found first
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      
Addition of two Number in Class
;    In this program we will learn how to calculate the sum of any two number. Java is a object oriented  programming language...; we are going to use addition of  two number. First of all, we have
Having a hard time writing program to calculate test scores..........
Having a hard time writing program to calculate test scores.......... ... questions on the test and the school would like you to gather some statistics on how... to have your program open the data file, count the number of elements in the file
Month Format Example
Month Format Example       This example shows how to format Month using Format class. In this program we use a pattern of special characters to Month format. Description
PHP Date add 1 month
PHP Date add 1 month This example shows you how one month can be added... to add 1 month: <?php //PHP Example code to add one moth to a date... month"); echo "After adding one month: ".date('l dS \o\f F Y

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.