diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2014-03-04 19:13:16 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2014-03-04 19:13:16 +0100 |
commit | 043c8db329100004317180264b8c01319c9898db (patch) | |
tree | 670e1fd863b98eb9723dab3d5da10d20f46c178c /cgeo-calendar | |
parent | 617638743c03123e61e6c149d3feac8320d6b1b2 (diff) | |
download | cgeo-043c8db329100004317180264b8c01319c9898db.zip cgeo-043c8db329100004317180264b8c01319c9898db.tar.gz cgeo-043c8db329100004317180264b8c01319c9898db.tar.bz2 |
refactor deprecated code
Diffstat (limited to 'cgeo-calendar')
-rw-r--r-- | cgeo-calendar/src/cgeo/calendar/CalendarEntry.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java b/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java index ff36aa4..a1761c7 100644 --- a/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java +++ b/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java @@ -11,6 +11,7 @@ import android.text.style.ImageSpan; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.util.Calendar; import java.util.Date; class CalendarEntry { @@ -80,12 +81,13 @@ class CalendarEntry { */ protected Date parseDate() { try { - final Date eventDate = new Date(Long.parseLong(getHiddenDate())); - eventDate.setHours(0); - eventDate.setMinutes(0); - eventDate.setSeconds(0); + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(Long.parseLong(getHiddenDate())); + cal.set(Calendar.HOUR_OF_DAY, 0); + cal.set(Calendar.MINUTE, 0); + cal.set(Calendar.SECOND, 0); - return eventDate; + return cal.getTime(); } catch (NumberFormatException e) { // cannot happen normally, but static code analysis does not know } |