1 3 package jodd.datetime; 4 5 import java.util.Calendar ; 6 import java.util.TimeZone ; 7 import java.util.Locale ; 8 9 import jodd.datetime.converter.*; 10 import jodd.datetime.formatter.DefaultFormatter; 11 import jodd.datetime.formatter.JdtFormatter; 12 import jodd.util.ObjectUtil; 13 import jodd.util.HashCodeUtil; 14 15 105 public class JDateTime implements Comparable , Cloneable { 106 107 110 protected DateTimeStamp time = new DateTimeStamp(); 111 112 115 protected int dayofweek; 116 117 120 protected int dayofyear; 121 122 125 protected boolean leap; 126 127 130 protected int weekofyear; 131 132 135 protected int weekofmonth; 136 137 140 protected JulianDateStamp jdate; 141 142 143 145 148 public static final JulianDateStamp JD_1970 = new JulianDateStamp(2440587.5); 149 150 153 public static final JulianDateStamp JD_2001 = new JulianDateStamp(2451910.5); 154 155 159 public static final JulianDateStamp JD_MJD = new JulianDateStamp(2400000.5); 160 161 165 public static final JulianDateStamp JD_RJD = new JulianDateStamp(2400000); 166 167 171 public static final JulianDateStamp JD_TJD = new JulianDateStamp(2440000.5); 172 173 174 175 177 181 public DateTimeStamp getDateTimeStamp() { 182 return time; 183 } 184 185 188 public void setDateTimeStamp(DateTimeStamp dts) { 189 set(dts.year, dts.month, dts.day, dts.hour, dts.minute, dts.second); 190 } 191 192 199 public void setJulianDate(JulianDateStamp jds) { 200 setJdOnly((JulianDateStamp) jds.clone()); 201 setParams(); 202 } 203 204 207 public JulianDateStamp getJulianDate() { 208 return jdate; 209 } 210 211 214 private void setParams() { 215 this.leap = TimeUtil.isLeapYear(time.year); 216 this.dayofweek = calcDayOfWeek(); 217 this.dayofyear = calcDayOfYear(); 218 this.weekofyear = calcWeekOfYear(getFirstDayOfWeek() ,getMustHaveDayOfFirstWeek()); 219 this.weekofmonth = weekNumber(time.day, this.dayofweek); 220 } 221 222 229 private void setJdOnly(JulianDateStamp jds) { 230 jdate = jds; 231 time = TimeUtil.fromJulianDate(jds); 232 } 233 234 245 public void set(int year, int month, int day, int hour, int minute, double second) { 246 247 double ms = (second - (int)second) * 1000; 250 if (ms > 999) { 251 ms = 999; 252 } else { 253 ms += 1e-9; 254 } 255 second = ((int) second) + ((int) ms / 1000.0); 256 jdate = TimeUtil.toJulianDate(year, month, day, hour, minute, second); 257 258 if (TimeUtil.isValidDateTime(year, month, day, hour, minute, second)) { 265 266 int ka = (int)(jdate.fraction + 0.5); 267 double frac = jdate.fraction + 0.5 - ka + 1e-10; 268 269 double d_hour = frac * 24.0; 271 272 double d_minute = (d_hour - (int)d_hour) * 60.0; 274 275 second = (d_minute - (int)d_minute) * 60.0; 276 277 second = ((int) (second * 10000) + 0.5) / 10000.0; 279 280 time.year = year; time.month = month; time.day = day; 281 time.hour = hour; time.minute = minute; time.second = second; 282 setParams(); 283 } else { 284 setJulianDate(jdate); 285 } 286 } 287 288 299 private void setJdOnly(int year, int month, int day, int hour, int minute, double second) { 300 setJdOnly(TimeUtil.toJulianDate(year, month, day, hour, minute, second)); 301 } 302 303 304 306 309 private int calcDayOfWeek() { 310 int jd = (int)(jdate.doubleValue() + 0.5); 311 return (jd % 7) + 1; 312 } 314 315 private static final int NUM_DAYS[] = {-1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; private static final int LEAP_NUM_DAYS[] = {-1, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}; 318 321 private int calcDayOfYear() { 322 if (leap == true) { 323 return LEAP_NUM_DAYS[time.month] + time.day; 324 } 325 return NUM_DAYS[time.month] + time.day; 326 } 327 328 329 339 private int calcWeekOfYear(int start, int must) { 340 341 int delta = 0; 347 if (start <= this.dayofweek) { 348 if (must < start) { 349 delta = 7; 350 } 351 } else { 352 if (must >= start) { 353 delta = -7; 354 } 355 } 356 357 int jd = (int)(jdate.doubleValue() + 0.5) + delta; 358 int WeekDay = (jd % 7) + 1; 359 360 int time_year = time.year; 361 int DayOfYearNumber = this.dayofyear + delta; 362 if (DayOfYearNumber < 1) { 363 time_year--; 364 DayOfYearNumber = TimeUtil.isLeapYear(time_year) ? 366 + DayOfYearNumber: 365 + DayOfYearNumber; 365 } else if (DayOfYearNumber > (this.leap ? 366 : 365)) { 366 DayOfYearNumber = this.leap ? DayOfYearNumber - 366: DayOfYearNumber - 365; 367 time_year++; 368 } 369 370 372 int firstDay = jd - DayOfYearNumber + 1; 373 int Jan1WeekDay = (firstDay % 7) + 1; 374 375 int YearNumber = time_year; 377 int WeekNumber = 52; 378 if ((DayOfYearNumber <= (8 - Jan1WeekDay)) && (Jan1WeekDay > must)) { 379 YearNumber--; 380 if ((Jan1WeekDay == must + 1) || ( (Jan1WeekDay == must + 2) && (TimeUtil.isLeapYear(YearNumber)) ) ) { 381 WeekNumber = 53; 382 } 383 } 384 385 int m = 365; 387 if (YearNumber == time_year) { 388 if (TimeUtil.isLeapYear(time_year) == true) { 389 m = 366; 390 } 391 if ((m - DayOfYearNumber) < (must - WeekDay)) { 392 YearNumber = time_year + 1; 393 WeekNumber = 1; 394 } 395 } 396 397 if (YearNumber == time_year) { 398 int n = DayOfYearNumber + (7 - WeekDay) + (Jan1WeekDay - 1); 399 WeekNumber = n / 7; 400 if (Jan1WeekDay > must) { 401 WeekNumber -= 1; 402 } 403 } 404 return WeekNumber; 405 } 406 407 423 private int weekNumber(int dayOfPeriod, int dayOfWeek) { 424 int periodStartDayOfWeek = (dayOfWeek - getFirstDayOfWeek() - dayOfPeriod + 1) % 7; 428 if (periodStartDayOfWeek < 0) { 429 periodStartDayOfWeek += 7; 430 } 431 432 int weekNo = (dayOfPeriod + periodStartDayOfWeek - 1) / 7; 436 437 if ((7 - periodStartDayOfWeek) >= getMinDaysInFirstWeek()) { 441 ++weekNo; 442 } 443 444 return weekNo; 445 } 446 447 449 470 471 public void add(int year, int month, int day, int hour, int minute, double second, boolean monthFix) { 472 second += time.second; 473 minute += time.minute; 474 hour += time.hour; 475 day += time.day; 476 if (monthFix == false) { 477 month += time.month; 478 year += time.year; 479 set(year, month, day, hour, minute, second); 480 } else { 481 setJdOnly(time.year, time.month, day, hour, minute, second); 487 int from = time.day; 488 month += time.month + (year * 12); setJdOnly(time.year, month, time.day, time.hour, time.minute, time.second); 490 if (time.day < from) { 491 set(time.year, time.month, 0, time.hour, time.minute, time.second); 492 } else { 493 setParams(); 494 } 495 496 506 } 507 } 508 509 510 522 public void add(int year, int month, int day, int hour, int minute, double second) { 523 add(year, month, day, hour, minute, second, getMonthFix()); 524 } 525 526 527 537 public void add(int year, int month, int day, boolean monthFix) { 538 add(year, month, day, 0, 0, 0, monthFix); 539 } 540 550 public void add(int year, int month, int day) { 551 add(year, month, day, getMonthFix()); 552 } 553 554 555 565 public void addTime(int hour, int minute, double second, boolean monthFix) { 566 add(0, 0, 0, hour, minute, second, monthFix); 567 } 568 577 public void addTime(int hour, int minute, double second) { 578 addTime(hour, minute, second, getMonthFix()); 579 } 580 581 582 588 public void addYear(int y, boolean monthFix) { 589 add(y, 0, 0, monthFix); 590 } 591 596 public void addYear(int y) { 597 addYear(y, getMonthFix()); 598 } 599 600 601 607 public void addMonth(int m, boolean monthFix) { 608 add(0, m, 0, monthFix); 609 } 610 615 public void addMonth(int m) { 616 addMonth(m, getMonthFix()); 617 } 618 619 625 public void addDay(int d, boolean monthFix) { 626 add(0, 0, d, monthFix); 627 } 628 633 public void addDay(int d) { 634 addDay(d, getMonthFix()); 635 } 636 637 643 public void addHour(int h, boolean monthFix) { 644 addTime(h, 0, 0, monthFix); 645 } 646 651 public void addHour(int h) { 652 addHour(h, getMonthFix()); 653 } 654 655 656 662 public void addMinute(int m, boolean monthFix) { 663 addTime(0, m, 0, monthFix); 664 } 665 670 public void addMinute(int m) { 671 addMinute(m, getMonthFix()); 672 } 673 674 680 public void addSecond(double s, boolean monthFix) { 681 addTime(0, 0, s, monthFix); 682 } 683 688 public void addSecond(double s) { 689 addSecond(s, getMonthFix()); 690 } 691 692 693 699 public void addMillisecond(int ms, boolean monthFix) { 700 addTime(0, 0, ms / 1000.0, monthFix); 701 } 702 707 public void addMillisecond(int ms) { 708 addMillisecond(ms, getMonthFix()); 709 } 710 711 713 725 public JDateTime(int year, int month, int day, int hour, int minute, double second) { 726 this.set(year, month, day, hour, minute, second); 727 } 728 729 736 public void set(int year, int month, int day) { 737 set(year, month, day, 0, 0, 0); 738 } 739 740 749 public JDateTime(int year, int month, int day) { 750 this.set(year, month, day); 751 } 752 753 760 public void setTime(int hour, int minute, double second) { 761 set(time.year, time.month, time.day, hour, minute, second); 762 } 763 764 771 public void setDate(int year, int month, int day) { 772 set(year, month, day, time.hour, time.minute, time.second); 773 } 774 775 776 778 786 public JDateTime(long milis) { 787 setTimeInMillis(milis); 788 } 789 790 798 public void setTimeInMillis(long millis) { 799 millis += getTimeZone().getOffset(millis); 800 JulianDateStamp now = new JulianDateStamp(); 801 now.integer = (int) (millis / TimeUtil.MILLIS_IN_DAY); 802 now.fraction = (double)(millis % TimeUtil.MILLIS_IN_DAY) / TimeUtil.MILLIS_IN_DAY; 803 now.integer += JD_1970.integer; 804 now.fraction += JD_1970.fraction; 805 if (now.fraction >= 1.0) { 806 now.integer++; 807 now.fraction -= 1.0; 808 } 809 setJulianDate(now); 810 } 811 812 821 public long getTimeInMillis() { 822 double then = (jdate.fraction - JD_1970.fraction) * TimeUtil.MILLIS_IN_DAY; 823 then += (jdate.integer - JD_1970.integer) * TimeUtil.MILLIS_IN_DAY; 824 then += then > 0 ? 1.0e-6 : -1.0e-6; 825 then -= getTimeZone().getOffset((long) then); 826 return (long) then; 827 } 828 829 830 832 837 public void setYear(int y) { 838 setDate(y, time.month, time.day); 839 } 840 841 846 public void setMonth(int m) { 847 setDate(time.year, m, time.day); 848 } 849 850 855 public void setDay(int d) { 856 setDate(time.year, time.month, d); 857 } 858 859 864 public void setHour(int h) { 865 setTime(h, time.minute, time.second); 866 } 867 868 873 public void setMinute(int m) { 874 setTime(time.hour, m, time.second); 875 876 } 877 878 883 public void setSecond(double s) { 884 setTime(time.hour, time.minute, s); 885 } 886 887 892 public void setSecond(int s) { 893 double milis = s + (time.second - (int)time.second); 894 setTime(time.hour, time.minute, milis); 895 } 896 897 902 public void setMillisecond(int m) { 903 setTime(time.hour, time.minute, ((int)time.second) + m/1000.0); 904 } 905 906 907 909 910 913 public int getYear() { 914 return time.year; 915 } 916 917 920 public int getMonth() { 921 return time.month; 922 } 923 924 928 public int getDay() { 929 return time.day; 930 } 931 932 936 public int getDayOfMonth() { 937 return time.day; 938 } 939 940 943 public int getHour() { 944 return time.hour; 945 } 946 947 950 public int getMinute() { 951 return time.minute; 952 } 953 954 958 public double getSecond() { 959 return time.second; 960 } 961 962 965 public int getMillisecond() { 966 return (int) ((time.second - (int)time.second) * 1000 + 1e-9); 967 } 968 969 971 974 public int getDayOfWeek() { 975 return dayofweek; 976 } 977 978 981 public int getDayOfYear() { 982 return dayofyear; 983 } 984 985 988 public boolean isLeapYear() { 989 return leap; 990 } 991 992 995 public int getWeekOfYear() { 996 return weekofyear; 997 } 998 999 1002 public int getWeekOfMonth() { 1003 return weekofmonth; 1004 } 1005 1006 1007 1010 private static final int MONTH_LENGTH[] = {0, 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 1011 1012 1015 public int getMonthLength(int m) { 1016 if ((m < 1) || (m > 12)) { 1017 throw new IllegalArgumentException ("Invalid month index: '" + m + "'."); 1018 } 1019 if (m == 2) { 1020 return this.leap ? 29 : 28; 1021 } 1022 if ((time.year == 1582) && (time.month == 10)) { 1023 return 21; 1024 } 1025 return MONTH_LENGTH[m]; 1026 } 1027 1028 1031 public int getMonthLength() { 1032 return getMonthLength(time.month); 1033 } 1034 1035 1037 1040 public void setCurrentTime() { 1041 setTimeInMillis(System.currentTimeMillis()); 1042 } 1043 1044 1047 public JDateTime() { 1048 this.setCurrentTime(); 1049 } 1050 1051 1053 1057 public void loadFrom(Object source) { 1058 JdtConverter converter = JdtConverterManager.lookup(source.getClass()); 1059 if (converter == null) { 1060 throw new IllegalArgumentException ("JdtConverter for '" + source.getClass() + "' type not registered."); 1061 } 1062 converter.loadFrom(this, source); 1063 } 1064 1065 1070 public Object convertTo(Class type) { 1071 JdtConverter converter = JdtConverterManager.lookup(type); 1072 if (converter == null) { 1073 throw new IllegalArgumentException ("JdtConverter for '" + type + "' type not registered."); 1074 } 1075 return converter.convertTo(this); 1076 } 1077 1078 1079 1083 public void storeTo(Object destination) { 1084 JdtConverter converter = JdtConverterManager.lookup(destination.getClass()); 1085 if (converter == null) { 1086 throw new IllegalArgumentException ("JdtConverter for '" + destination.getClass() + "' type not registered."); 1087 } 1088 converter.storeTo(this, destination); 1089 } 1090 1091 1093 1097 public java.util.Calendar convertToCalendar() { 1098 return (java.util.Calendar ) convertTo(java.util.Calendar .class); 1099 } 1100 1101 1105 public java.util.Date convertToDate() { 1106 return (java.util.Date ) convertTo(java.util.Date .class); 1107 } 1108 1109 1113 public java.util.GregorianCalendar convertToGregorianCalendar() { 1114 return (java.util.GregorianCalendar ) convertTo(java.util.GregorianCalendar .class); 1115 } 1116 1117 1121 public java.sql.Date convertToSqlDate() { 1122 return (java.sql.Date ) convertTo(java.sql.Date .class); 1123 } 1124 1125 1129 public java.sql.Timestamp convertToSqlTimestamp() { 1130 return (java.sql.Timestamp ) convertTo(java.sql.Timestamp .class); 1131 } 1132 1133 1137 public DateTimeStamp convertToDateTimeStamp() { 1138 return (DateTimeStamp) convertTo(DateTimeStamp.class); 1139 } 1140 1141 1142 1144 1148 public JDateTime(Object o) { 1149 loadFrom(o); 1150 } 1151 1152 1155 public JDateTime(DateTimeStamp dts) { 1156 setDateTimeStamp(dts); 1157 } 1158 1159 1160 1163 public JDateTime(JulianDateStamp jds) { 1164 setJulianDate(jds); 1165 } 1166 1168 1171 public static boolean DEFAULT_MONTH_FIX = true; 1172 1173 private Boolean monthFix = null; 1174 1175 1179 public void setMonthFix(Boolean monthFix) { 1180 this.monthFix = monthFix; 1181 } 1182 1183 1186 public void setDefaultMonthFix() { 1187 setMonthFix(null); 1188 } 1189 1190 1194 public boolean getMonthFix() { 1195 return (monthFix != null ? monthFix.booleanValue() : DEFAULT_MONTH_FIX); 1196 } 1197 1198 1199 1201 private TimeZone timezone = null; 1202 1203 1207 public void setTimeZone(TimeZone timezone) { 1208 long now = getTimeInMillis(); 1209 int offsetBefore = getTimeZone().getOffset(now); 1210 this.timezone = timezone; 1211 int offsetAfter = getTimeZone().getOffset(now); 1212 if (offsetAfter != offsetBefore) { 1213 addMillisecond(offsetAfter - offsetBefore); 1214 } 1215 } 1216 1217 1220 public void setDefaultTimeZone() { 1221 setTimeZone(null); 1222 } 1223 1224 1228 public TimeZone getTimeZone() { 1229 return (timezone != null ? timezone : TimeZone.getDefault()); 1230 } 1231 1232 1233 1235 private Locale locale = null; 1236 1237 1241 public void setLocale(Locale locale) { 1242 this.locale = locale; 1243 } 1244 1245 1248 public void setDefaultLocale() { 1249 setLocale(null); 1250 } 1251 1252 1256 public Locale getLocale() { 1257 return (locale != null ? locale : Locale.getDefault()); 1258 } 1259 1260 1262 1265 public static String DEFAULT_FORMAT = "YYYY-MM-DD hh:mm:ss.mss"; 1266 1267 private String format = null; 1268 1269 1273 public void setFormat(String newFormat) { 1274 format = newFormat; 1275 } 1276 1277 1280 public void setDefaultFormat() { 1281 setFormat(null); 1282 } 1283 1284 1288 public String getFormat() { 1289 return (format != null ? format : DEFAULT_FORMAT); 1290 } 1291 1292 1293 1295 1298 public static JdtFormatter DEFAULT_JDTFORMATTER = new DefaultFormatter(); 1299 1300 private JdtFormatter jdtFormatter = null; 1301 1302 1306 public void setJdtFormatter(JdtFormatter jdtFormatter) { 1307 this.jdtFormatter = jdtFormatter; 1308 } 1309 1310 public void setDefaultJdtFormatter() { 1311 setJdtFormatter(null); 1312 } 1313 1314 1318 public JdtFormatter getJdtFormatter() { 1319 return (jdtFormatter != null ? jdtFormatter : DEFAULT_JDTFORMATTER); 1320 } 1321 1322 1323 1325 1329 public String toString(String template) { 1330 return getJdtFormatter().convert(this, template); 1331 } 1332 1333 1337 public String toString() { 1338 return toString(getFormat()); 1339 } 1340 1341 1342 1347 public void fromString(String s, String template) { 1348 DateTimeStamp dts = getJdtFormatter().parse(s, template); 1349 if (dts != null) { 1350 setDateTimeStamp(dts); 1351 } 1352 } 1353 1354 1359 public void fromString(String s) { 1360 fromString(s, getFormat()); 1361 } 1362 1363 1368 public boolean isValid(String s) { 1369 return isValid(s, getFormat()); 1370 } 1371 1372 1377 public boolean isValid(String s, String template) { 1378 DateTimeStamp dtsOriginal = getJdtFormatter().parse(s, template); 1379 if (dtsOriginal == null) { 1380 return false; 1381 } 1382 return TimeUtil.isValidDateTime(dtsOriginal); 1383 } 1384 1385 1386 1388 1391 public static int DEFAULT_FIRST_DAY_OF_WEEK = 1; 1392 1393 private int firstDayOfWeek = 0; 1394 1395 1398 public static int DEFAULT_MUST_HAVE_DAY_OF_FIRST_WEEK = 4; 1399 1400 private int mustHaveDayOfFirstWeek = 0; 1401 1402 1409 public void setWeekDefinition(int start, int must) { 1410 if (start == 0) { 1411 firstDayOfWeek = 0; 1412 } else if ((start >= 1) && (start <= 7)) { 1413 firstDayOfWeek = start; 1414 } 1415 if (must == 0) { 1416 mustHaveDayOfFirstWeek = 0; 1417 } else if ((must >= 1) && (must <= 7)) { 1418 mustHaveDayOfFirstWeek = must; 1419 minDaysInFirstWeek = convertMin2Must(getFirstDayOfWeek(), must); 1420 } 1421 } 1422 1423 1426 public void setDefaultWeekDefinition() { 1427 setWeekDefinition(0, 0); 1428 } 1429 1430 1433 public int getFirstDayOfWeek() { 1434 return (firstDayOfWeek != 0 ? firstDayOfWeek : DEFAULT_FIRST_DAY_OF_WEEK); 1435 } 1436 1437 1440 public int getMustHaveDayOfFirstWeek() { 1441 return (mustHaveDayOfFirstWeek != 0 ? mustHaveDayOfFirstWeek : DEFAULT_MUST_HAVE_DAY_OF_FIRST_WEEK); 1442 } 1443 1444 1445 1447 1450 public static int DEFAULT_MIN_DAYS_IN_FIRST_WEEK = 4; 1451 1452 private int minDaysInFirstWeek = 0; 1453 1454 1460 public int getMinDaysInFirstWeek() { 1461 return (minDaysInFirstWeek != 0 ? minDaysInFirstWeek : DEFAULT_MIN_DAYS_IN_FIRST_WEEK); 1462 } 1463 1464 1470 1471 public void setWeekDefinitionAlt(int start, int min) { 1472 if (start == 0) { 1473 firstDayOfWeek = 0; 1474 } if ((start >= 1) && (start <= 7)) { 1475 firstDayOfWeek = start; 1476 } 1477 if (min == 0) { 1478 mustHaveDayOfFirstWeek = 0; 1479 minDaysInFirstWeek = 0; 1480 } else if ((min >= 1) && (min <= 7)) { 1481 mustHaveDayOfFirstWeek = convertMin2Must(getFirstDayOfWeek(), min); 1482 minDaysInFirstWeek = min; 1483 } 1484 } 1485 1486 1489 public void setDefaultWeekDefinitionAlt() { 1490 setWeekDefinitionAlt(0, 0); 1491 } 1492 1493 1502 private static int convertMin2Must(int start, int min) { 1503 int must = 8 - min + (start - 1); 1504 if (must > 7) { 1505 must -= 7; 1506 } 1507 return must; 1508 } 1509 1510 1512 Object [] state = new Object [] { 1513 jdate, 1514 locale, 1515 timezone, 1516 format, 1517 jdtFormatter, 1518 }; 1519 1520 public boolean equals(Object object) { 1521 if (this == object) { 1522 return true; 1523 } 1524 if (ObjectUtil.equalsType(object, this) == false) { 1525 return false; 1526 } 1527 final JDateTime jdt = (JDateTime) object; 1528 return (this.monthFix == jdt.monthFix) && 1529 (this.firstDayOfWeek == jdt.firstDayOfWeek) && 1530 (this.mustHaveDayOfFirstWeek == jdt.mustHaveDayOfFirstWeek) && 1531 ObjectUtil.equalsEx(state, jdt.state); 1532 } 1533 1534 public int hashCode() { 1535 int result = HashCodeUtil.SEED; 1536 result = HashCodeUtil.hash(result, state); 1537 result = HashCodeUtil.hash(result, monthFix); 1538 result = HashCodeUtil.hash(result, firstDayOfWeek); 1539 result = HashCodeUtil.hash(result, mustHaveDayOfFirstWeek); 1540 return result; 1541 } 1542 1543 1544 1546 public Object clone() { 1547 JDateTime jdt = new JDateTime(this.jdate); 1548 jdt.monthFix = this.monthFix; 1549 jdt.timezone = this.timezone; 1550 jdt.locale = this.locale; 1551 jdt.format = this.format; 1552 jdt.jdtFormatter = this.jdtFormatter; 1553 jdt.firstDayOfWeek = this.firstDayOfWeek; 1554 jdt.mustHaveDayOfFirstWeek = this.mustHaveDayOfFirstWeek; 1555 return jdt; 1556 } 1557 1558 1559 1561 1569 public int compareTo(Object gt) { 1570 return time.compareTo(((JDateTime)gt).getDateTimeStamp()); 1571 } 1572 1573} 1574 | Popular Tags |