← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14998: Minor addition to DateUnit, support for creating DateUnit from Jdk Calendar

 

------------------------------------------------------------
revno: 14998
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-04-26 12:24:12 +0545
message:
  Minor addition to DateUnit, support for creating DateUnit from Jdk Calendar
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.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-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java	2014-04-26 06:29:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java	2014-04-26 06:39:12 +0000
@@ -137,6 +137,12 @@
         return new DateUnit( dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), dateTime.getDayOfWeek() );
     }
 
+    public static DateUnit fromJdkCalendar( java.util.Calendar calendar )
+    {
+        return new DateUnit( calendar.get( java.util.Calendar.YEAR ), calendar.get( java.util.Calendar.MONTH ),
+            calendar.get( java.util.Calendar.DAY_OF_MONTH ), calendar.get( java.util.Calendar.DAY_OF_WEEK ) );
+    }
+
     @Override
     public String toString()
     {