X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Fclub%2Fwpia%2Fgigi%2Futil%2FDayDate.java;h=85473eccdf1b7999e51542be10655b84ced0d648;hp=8ade34270b444839aa9549f72e746ce17d54460d;hb=10e752c710c50035de036a79bc26fbedc7c8a460;hpb=bccd4cc0dba0f89aa045b113bac46eb8cc1dab4e diff --git a/src/club/wpia/gigi/util/DayDate.java b/src/club/wpia/gigi/util/DayDate.java index 8ade3427..85473ecc 100644 --- a/src/club/wpia/gigi/util/DayDate.java +++ b/src/club/wpia/gigi/util/DayDate.java @@ -8,7 +8,9 @@ import java.sql.Date; */ public class DayDate { - public static final long MILLI_DAY = 24 * 60 * 60 * 1000; + private static final int MILLI_HOUR = 60 * 60 * 1000; + + public static final long MILLI_DAY = 24 * MILLI_HOUR; private long time; @@ -75,4 +77,24 @@ public class DayDate { public java.util.Date toDate() { return new java.util.Date(time); } + + // Timezones currently reach from UTC-12 to UTC+14 that allows us to define + // the "earliest start" and "latest end" of a Date. + /** + * Gets this date's starting point. + * + * @return The earliest point in time where this date was in any timezone + */ + public java.util.Date start() { + return new java.util.Date(time - 12 * MILLI_HOUR); + } + + /** + * Gets this date's ending point. + * + * @return The latest point in time where this Date was any timezone + */ + public java.util.Date end() { + return new java.util.Date(time + 14 * MILLI_HOUR + 24 * MILLI_HOUR); + } }