cancel
Showing results for 
Search instead for 
Did you mean: 

Converting US week number to Ireland WeekNumber

Former Member
0 Kudos

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 .

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

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){

}

Former Member
0 Kudos

Thanks Gopal

Answers (0)