Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. private double adjustNegativeDatesFromAccess(double value) {
  2. double fractionalPart = value % 1.0; // Negative if value is negative.
  3. double wholePart = value - fractionalPart;
  4. return wholePart + Math.abs(fractionalPart);
  5. }
  6.  
  7. // Simplified equivalent implementation (avoids touching positive dates).
  8. private double adjustNegativeDatesFromAccess2(double value) {
  9. return value >= 0.0 ? value : (value - 2.0 * (value % 1.0));
  10. }
  11.  
  12. public long fromDateDouble(double value) {
  13. long time = Math.round(adjustNegativeDatesFromAccess2(value) * MILLISECONDS_PER_DAY);
  14. time -= MILLIS_BETWEEN_EPOCH_AND_1900;
  15. time -= getFromLocalTimeZoneOffset(time);
  16. return time;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement