← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15707: Made a static final variable out of the supported date formats in DateUtils

 

------------------------------------------------------------
revno: 15707
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-06-16 22:10:19 +0200
message:
  Made a static final variable out of the supported date formats in DateUtils
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java	2014-06-06 10:19:36 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java	2014-06-16 20:10:19 +0000
@@ -51,6 +51,16 @@
  */
 public class DateUtils
 {
+    public static final SimpleDateFormat[] SUPPORTED_DATE_FORMATS = new SimpleDateFormat[] {
+        new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssZ" ),
+        new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss" ),
+        new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm" ),
+        new SimpleDateFormat( "yyyy-MM-dd'T'HH" ),
+        new SimpleDateFormat( "yyyy-MM-dd" ),
+        new SimpleDateFormat( "yyyy-MM" ),
+        new SimpleDateFormat( "yyyy" )
+    };
+    
     public static final double DAYS_IN_YEAR = 365.0;
 
     private static final long MS_PER_DAY = 86400000;
@@ -514,17 +524,7 @@
             return null;
         }
 
-        SimpleDateFormat[] supportedDateFormats = new SimpleDateFormat[]{
-            new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssZ" ),
-            new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss" ),
-            new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm" ),
-            new SimpleDateFormat( "yyyy-MM-dd'T'HH" ),
-            new SimpleDateFormat( "yyyy-MM-dd" ),
-            new SimpleDateFormat( "yyyy-MM" ),
-            new SimpleDateFormat( "yyyy" )
-        };
-
-        for ( SimpleDateFormat format : supportedDateFormats )
+        for ( SimpleDateFormat format : SUPPORTED_DATE_FORMATS )
         {
             try
             {