on 04-04-2011 4:40 PM
Hi All,
As per US calender every 4th year will contain 53 weeks . In case of ireland calender , every year has 52 weeks ...
So , the requirement over here is ..in case if US calendar contains 53 weeks , then i need to subract the weeknumebr coming from US by 1 and send it to Ireland .
Ex : week numner 13 (US) will be week number 12 (ireland)..
How to achive the above using standard java functions .
Below is code snippet. Please modify according to your requirement.
try{
DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date dec2011 = sdf.parse("31/12/2011");
Calendar calUs = Calendar.getInstance(Locale.US);
calUs.setTime(dec2011);
Calendar calIR = Calendar.getInstance(Locale.UK);
calIR.setTime(dec2011);
System.out.println( "us: " + calUs.get( Calendar.WEEK_OF_YEAR ) );
System.out.println( "ir: " + calIR.get( Calendar.WEEK_OF_YEAR ) );
}catch(Exception e){
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.