Converts the value of this Timestamp as a Calendar, in its local time. Because Calendar instances are mutable, this method returns a new instance from each call. @return a new Calendar instance, in its local time.
()
| 1587 | |
| 1588 | */ |
| 1589 | public Calendar calendarValue() |
| 1590 | { |
| 1591 | Calendar cal = new GregorianCalendar(_Private_Utils.UTC); |
| 1592 | |
| 1593 | long millis = getMillis(); |
| 1594 | Integer offset = _offset; |
| 1595 | if (offset != null && offset != 0) |
| 1596 | { |
| 1597 | int offsetMillis = offset * 60 * 1000; |
| 1598 | millis += offsetMillis; |
| 1599 | cal.setTimeInMillis(millis); // Resets the offset! |
| 1600 | cal.set(Calendar.ZONE_OFFSET, offsetMillis); |
| 1601 | } |
| 1602 | else |
| 1603 | { |
| 1604 | cal.setTimeInMillis(millis); |
| 1605 | } |
| 1606 | |
| 1607 | switch (_precision) { |
| 1608 | case YEAR: |
| 1609 | cal.clear(Calendar.MONTH); |
| 1610 | case MONTH: |
| 1611 | cal.clear(Calendar.DAY_OF_MONTH); |
| 1612 | case DAY: |
| 1613 | cal.clear(Calendar.HOUR_OF_DAY); |
| 1614 | cal.clear(Calendar.MINUTE); |
| 1615 | case MINUTE: |
| 1616 | cal.clear(Calendar.SECOND); |
| 1617 | cal.clear(Calendar.MILLISECOND); |
| 1618 | case SECOND: |
| 1619 | if (_fraction == null) { |
| 1620 | cal.clear(Calendar.MILLISECOND); |
| 1621 | } |
| 1622 | } |
| 1623 | |
| 1624 | return cal; |
| 1625 | } |
| 1626 | |
| 1627 | |
| 1628 | /** |