~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to local/in/dhis-web-ga/WEB-INF/src/org/hisp/gtool/utilities/GAUtilities.java

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.hisp.gtool.utilities;
 
2
 
 
3
public class GAUtilities {
 
4
 
 
5
        /*
 
6
         * To get the Date Format as Jan-2007 From 2007-01-01 Format
 
7
         */
 
8
        public String getMonYearFormat(String strDate)
 
9
        {               
 
10
                String monthNames[] = 
 
11
                                {
 
12
                                        "","Jan","Feb","Mar","Apr","May","Jun",
 
13
                                        "Jul","Aug","Sep","Oct","Nov","Dec"
 
14
                                };
 
15
                String partsOfStartingDate[] = strDate.split("-");              
 
16
                int selectedMonth = 0;
 
17
                
 
18
                try
 
19
                {
 
20
                        selectedMonth = Integer.parseInt(partsOfStartingDate[1]);
 
21
                }
 
22
                catch(Exception e)
 
23
                {
 
24
                        selectedMonth = 0;
 
25
                }               
 
26
                String monYearFormat = monthNames[selectedMonth]+"-"+partsOfStartingDate[0];            
 
27
                return monYearFormat;           
 
28
        }// getMonYearFormat end
 
29
 
 
30
        /*
 
31
         * Returns the concatinated String For Individual String Tokens
 
32
         */
 
33
        public String getConcatedString(String[] strArray, String concatOpe)
 
34
        {
 
35
                int count = 0;
 
36
                String concatedString = "";
 
37
                while(count < strArray.length -1)
 
38
                {
 
39
                        concatedString += strArray[count] + concatOpe;
 
40
                        count++;
 
41
                }// while loop end
 
42
                concatedString +=  strArray[count];
 
43
                return concatedString;          
 
44
        }// getConcatedString end
 
45
        
 
46
}// class end