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



Home Answers Viewqa Java-Beginners Java Date Utility
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


bliss
Java Date Utility
1 Answer(s)      5 years and 5 months ago
Posted in : Java Beginners



Advertisement
View Answers

July 1, 2009 at 2:22 PM


Hi Friend,

Try the following code:

import java.util.*;

public class GetWeeks{

public static int getNumWeeksForYear(int year) {
Calendar c = Calendar.getInstance();
c.set(year, 0, 1);
return c.getMaximum(Calendar.WEEK_OF_YEAR);
}
public static void main(String[]args){
GetWeeks week=new GetWeeks();
int numOfWeeks= week.getNumWeeksForYear(2009);
System.out.println("Number of weeks are: "+numOfWeeks);
}
}

Thanks


Related Tutorials/Questions & Answers:
Java Date Utility - Java Beginners
Java Date Utility  How to determine the maximum number of weeks in a year (52 or 53) as per the ISO Calendar? Is there any standard method in java to implement this? Or any custom method which have been used? Help needed urgently
Singletone utility in java
Singletone utility in java  Please provide me an example of singletone utility in java
Advertisements
Java Util Package - Utility Package of Java
Java Util Package - Utility Package of Java       Java Utility package is one of the most commonly used packages in the java program. The Utility Package of Java consist
Java Date conversion - Date Calendar
Java Date conversion  How do I convert 'Mon Mar 28 00:00:00 IST 1983' which is a java.util.Date or String to yyyy/MM/dd date format in sql
Date Java - Java Beginners
Date Java  I'm using the eclipse software and I get an error for my...: public class Date { private int month; // 1-12 private int day; // 1-31... for day. public Date( int theMonth, int theDay, int theYear ) { if ( theMonth
Mysql Date To Java Date
Mysql Date To Java Date       Mysql Date To Java Date retrieve the records from Mysql and display the date in java. Understand with Example The Tutorial illustrate an example from
how to add date and change date in java - netbeans
how to add date and change date in java - netbeans  I need to code use to increase date How to get date after 30 days using netbeans
java Date - Java Beginners
java Date  Dear sir I have an assignment, It is .. "Develop Date class in java similar to the one available in java.util package.Use JavaDoc..., Try the following code: public class Date { private final int month
jQuery UI Utility : Position
jQuery UI Utility : Position       jQuery UI Utility : Position The position utility script is used for positioning any widget relative
java - Date Calendar
Java convert string to date  I need an example in Java to convert the string to date.  Convert string to date formatimport... str_date="04-04-2008"; DateFormat formatter ; Date date
date picker - Java Beginners
date picker  sir i need code for date picker in java swing because for Embedding in my project plz sir
"jQuery. browser " utility method
"jQuery. browser " utility method In this tutorial, we will discuss about the "jQuery.browser' utility method. Using this method you can detect which browser is accessing the page and what is the version
Display Date - Java Beginners
Display Date  Plz send me sample java program that display day, date... to display day,date,year and current time. import java.util.*; class DateExample { public static void main(String[] args) { Date date = new Date
jQuery Utility Functions
jQuery Utility Functions      In this section we are discussing about jQuery Utility Functions... of jQuery Utility Functions: .clearQueue() This function is used to remove all
Java programme - Date Calendar
Java programme  Can you provide me the coding for Date class provided by java util package
Java Date - Java Beginners
Java Date  I have to find the previous date's beginning time and end time in the long milliseconds format. for example today date is '23rd April... main(String[] args) { Date now = new Date(); DateFormat df   Hi friend
Parsing date in Java
Parsing date in Java  How can i parse the date in Java in a simple format..?   SimpleDateFormat parserSDF=new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy
java format date
java format date  Hi, How can I format the date in the following...) { Date date=new Date(); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); String formattedDate=sdf.format(date
date - Java Beginners
date  1.Write a program to check input date is valid or not using java(value must be given by user)  Hi Friend, Try the following code... DateValidation{ public boolean isValidDate(String date){ SimpleDateFormat sdf = new
java yesterday - Date Calendar
java yesterday  And how to make date format DD/MM/YYYY,thank's ... static void main(String args[]){ Date todaysDate = new java.util.Date... formattedDate = formatter.format(todaysDate); System.out.println("Formatted date
java date - Java Beginners
java date   Hi, Please observe the below code: import... is "login" the name,date,time is automaticaaly inserted into the database . My doubt is iam storeing system date and system time but i want to store i server
ask java - Date Calendar
but in java i found too but i can't to join in another frame. And i want to ask how to subtract a date, ex:i work since 2008/09/01 so i'am work until now 1 month 10... { public static void main(String[] args) { Date date = new Date
Date picker in Java Swing
Date picker in Java Swing  Hello Sir, Sir ,I am in need of Time Picker just like the Date picker available in java Swing. Kindly... link: Java Date Time Picker Example   Hello Sir, Thank
java yesterday - Date Calendar
java yesterday  Afternoon,Yesterday i have a question that how to make date sustract, the result is to make 1 month and 1 day like this, right. now how about 1 year and 1 month? And Can help me to using Date Calender what
java - Date Calendar
java   Using java how can i change the date format of the system from mm/dd/yy to dd/mm/yy. The code which i wrote is changing the format only on the console and not on the system's control panel.Can you suggest me anything
date problem - Java Beginners
date problem  how to extract day,month,year hours ,second from a string date. Examples: String dat ="200912202934" from this string extract month ,year,date,hours,minute Please help me. Thanks in advance Sushil 
Java String To Date
Java String To Date In this section you will read about how to convert... be convert into java.util.Date. Java string to date convert explains the conversion of Java string written into the specified format to a Java date object
Getting Computer Date in java
Getting Computer Date in java  Hi , I want to get the PC Date... but this.. String strDate = new Date(); I get this server error, "The type Date is ambiguous". I've also tried Date date = new Date(); ... but it get's the same error
java again - Date Calendar
java again  I can't combine your source code yesterday, can you help... : Date now : jtextfield1 //jTexfield1=date now //we enter ,then result in jTextfield2 Date work : jtextfield2 This my Source
date and time in awt(java)
date and time in awt(java)  sir, do you have an example of date in awt java which can be view over a textfield.   Display time in JTextField import java.util.*; import javax.swing.*; import java.awt.event.*; public
Java Date
The Java Date class allows the developers to manipulate date and time from within the Java program. The Java Date class is very useful... the date with the Java Date or calendar class.   The Java Date class
Advertisements
 

 

 

DMCA.com