001 /* 002 * Copyright 2001-2005 Stephen Colebourne 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.joda.time; 017 018 import org.joda.time.chrono.BuddhistChronology; 019 import org.joda.time.chrono.CopticChronology; 020 import org.joda.time.chrono.GJChronology; 021 import org.joda.time.chrono.GregorianChronology; 022 import org.joda.time.chrono.ISOChronology; 023 import org.joda.time.chrono.JulianChronology; 024 025 /** 026 * Chronology provides access to the individual date time fields for a 027 * chronological calendar system. 028 * <p> 029 * Various chronologies are supported by subclasses including ISO 030 * and GregorianJulian. To construct a Chronology you should use the 031 * factory methods on the chronology subclass in the chrono package. 032 * <p> 033 * For example, to obtain the current time in the coptic calendar system: 034 * <pre> 035 * DateTime dt = new DateTime(CopticChronology.getInstance()); 036 * </pre> 037 * <p> 038 * The provided chronology implementations are: 039 * <ul> 040 * <li>ISO - Based on the ISO8601 standard and suitable for use after about 1600 041 * <li>GJ - Historically accurate calendar with Julian followed by Gregorian 042 * <li>Gregorian - The Gregorian calendar system used for all time (proleptic) 043 * <li>Julian - The Julian calendar system used for all time (proleptic) 044 * <li>Buddhist - The Buddhist calendar system which is an offset in years from GJ 045 * <li>Coptic - The Coptic calendar system which defines 30 day months 046 * <li>Ethiopic - The Ethiopic calendar system which defines 30 day months 047 * </ul> 048 * Hopefully future releases will contain more chronologies. 049 * <p> 050 * This class defines a number of fields with names from the ISO8601 standard. 051 * It does not 'strongly' define these fields however, thus implementations 052 * are free to interpret the field names as they wish. 053 * For example, a week could be defined as 10 days and a month as 40 days in a 054 * special WeirdChronology implementation. Clearly the GJ and ISO 055 * implementations provided use the field names as you would expect. 056 * 057 * @see org.joda.time.chrono.ISOChronology 058 * @see org.joda.time.chrono.GJChronology 059 * @see org.joda.time.chrono.GregorianChronology 060 * @see org.joda.time.chrono.JulianChronology 061 * @see org.joda.time.chrono.CopticChronology 062 * @see org.joda.time.chrono.BuddhistChronology 063 * @see org.joda.time.chrono.EthiopicChronology 064 * 065 * @author Stephen Colebourne 066 * @author Brian S O'Neill 067 * @since 1.0 068 */ 069 public abstract class Chronology { 070 071 /** 072 * Gets an instance of the ISOChronology in the default zone. 073 * <p> 074 * {@link ISOChronology} defines all fields in line with the ISO8601 standard. 075 * This chronology is the default, and is suitable for all normal datetime processing. 076 * It is <i>unsuitable</i> for historical datetimes before October 15, 1582 077 * as it applies the modern Gregorian calendar rules before that date. 078 * 079 * @return the ISO chronology 080 * @deprecated Use ISOChronology.getInstance() 081 */ 082 public static Chronology getISO() { 083 return ISOChronology.getInstance(); 084 } 085 086 /** 087 * Gets an instance of the ISOChronology in the UTC zone. 088 * <p> 089 * {@link ISOChronology} defines all fields in line with the ISO8601 standard. 090 * This chronology is the default, and is suitable for all normal datetime processing. 091 * It is <i>unsuitable</i> for historical datetimes before October 15, 1582 092 * as it applies the modern Gregorian calendar rules before that date. 093 * 094 * @return the ISO chronology 095 * @deprecated Use ISOChronology.getInstanceUTC() 096 */ 097 public static Chronology getISOUTC() { 098 return ISOChronology.getInstanceUTC(); 099 } 100 101 /** 102 * Gets an instance of the ISOChronology in the specified zone. 103 * <p> 104 * {@link ISOChronology} defines all fields in line with the ISO8601 standard. 105 * This chronology is the default, and is suitable for all normal datetime processing. 106 * It is <i>unsuitable</i> for historical datetimes before October 15, 1582 107 * as it applies the modern Gregorian calendar rules before that date. 108 * 109 * @param zone the zone to use, null means default zone 110 * @return the ISO chronology 111 * @deprecated Use ISOChronology.getInstance(zone) 112 */ 113 public static Chronology getISO(DateTimeZone zone) { 114 return ISOChronology.getInstance(zone); 115 } 116 117 //----------------------------------------------------------------------- 118 /** 119 * Gets an instance of the GJChronology in the default zone. 120 * <p> 121 * {@link GJChronology} defines all fields using standard meanings. 122 * This chronology is intended to be used as a replacement for <code>GregorianCalendar</code>. 123 * The Gregorian calendar system is used after October 15, 1582, while the 124 * Julian calendar system is used before. 125 * <p> 126 * Unlike <code>GregorianCalendar</code>, this chronology returns a year of -1 127 * for 1 BCE, -2 for 2 BCE and so on. Thus there is no year zero. 128 * <p> 129 * This method uses the standard Julian to Gregorian cutover date of 130 * October 15th 1582. If you require a cutover on a different date, then use 131 * the factories on <code>GJChronology</code> itself. 132 * <p> 133 * When dealing solely with dates in the modern era, from 1600 onwards, 134 * we recommend using ISOChronology, which is the default. 135 * 136 * @return the GJ chronology 137 * @deprecated Use GJChronology.getInstance() 138 */ 139 public static Chronology getGJ() { 140 return GJChronology.getInstance(); 141 } 142 143 /** 144 * Gets an instance of the GJChronology in the UTC zone. 145 * <p> 146 * {@link GJChronology} defines all fields using standard meanings. 147 * This chronology is intended to be used as a replacement for <code>GregorianCalendar</code>. 148 * The Gregorian calendar system is used after October 15, 1582, while the 149 * Julian calendar system is used before. 150 * <p> 151 * Unlike <code>GregorianCalendar</code>, this chronology returns a year of -1 152 * for 1 BCE, -2 for 2 BCE and so on. Thus there is no year zero. 153 * <p> 154 * This method uses the standard Julian to Gregorian cutover date of 155 * October 15th 1582. If you require a cutover on a different date, then use 156 * the factories on <code>GJChronology</code> itself. 157 * <p> 158 * When dealing solely with dates in the modern era, from 1600 onwards, 159 * we recommend using ISOChronology, which is the default. 160 * 161 * @return the GJ chronology 162 * @deprecated Use GJChronology.getInstanceUTC() 163 */ 164 public static Chronology getGJUTC() { 165 return GJChronology.getInstanceUTC(); 166 } 167 168 /** 169 * Gets an instance of the GJChronology in the specified zone. 170 * <p> 171 * {@link GJChronology} defines all fields using standard meanings. 172 * This chronology is intended to be used as a replacement for <code>GregorianCalendar</code>. 173 * The Gregorian calendar system is used after October 15, 1582, while the 174 * Julian calendar system is used before. 175 * <p> 176 * Unlike <code>GregorianCalendar</code>, this chronology returns a year of -1 177 * for 1 BCE, -2 for 2 BCE and so on. Thus there is no year zero. 178 * <p> 179 * This method uses the standard Julian to Gregorian cutover date of 180 * October 15th 1582. If you require a cutover on a different date, then use 181 * the factories on <code>GJChronology</code> itself. 182 * <p> 183 * When dealing solely with dates in the modern era, from 1600 onwards, 184 * we recommend using ISOChronology, which is the default. 185 * 186 * @param zone the zone to use, null means default zone 187 * @return the GJ chronology 188 * @deprecated Use GJChronology.getInstance(zone) 189 */ 190 public static Chronology getGJ(DateTimeZone zone) { 191 return GJChronology.getInstance(zone); 192 } 193 194 //----------------------------------------------------------------------- 195 /** 196 * Gets an instance of the GregorianChronology in the default zone. 197 * <p> 198 * {@link GregorianChronology} defines all fields using standard meanings. 199 * It uses the Gregorian calendar rules <i>for all time</i> (proleptic) 200 * thus it is NOT a replacement for <code>GregorianCalendar</code>. 201 * For that purpose, you should use {@link #getGJ()}. 202 * <p> 203 * The Gregorian calendar system defines a leap year every four years, 204 * except that every 100 years is not leap, but every 400 is leap. 205 * <p> 206 * Technically, this chronology is almost identical to the ISO chronology, 207 * thus we recommend using ISOChronology instead, which is the default. 208 * 209 * @return the Gregorian chronology 210 * @deprecated Use GregorianChronology.getInstance() 211 */ 212 public static Chronology getGregorian() { 213 return GregorianChronology.getInstance(); 214 } 215 216 /** 217 * Gets an instance of the GregorianChronology in the UTC zone. 218 * <p> 219 * {@link GregorianChronology} defines all fields using standard meanings. 220 * It uses the Gregorian calendar rules <i>for all time</i> (proleptic) 221 * thus it is NOT a replacement for <code>GregorianCalendar</code>. 222 * For that purpose, you should use {@link #getGJ()}. 223 * <p> 224 * The Gregorian calendar system defines a leap year every four years, 225 * except that every 100 years is not leap, but every 400 is leap. 226 * <p> 227 * Technically, this chronology is almost identical to the ISO chronology, 228 * thus we recommend using ISOChronology instead, which is the default. 229 * 230 * @return the Gregorian chronology 231 * @deprecated Use GregorianChronology.getInstanceUTC() 232 */ 233 public static Chronology getGregorianUTC() { 234 return GregorianChronology.getInstanceUTC(); 235 } 236 237 /** 238 * Gets an instance of the GregorianChronology in the specified zone. 239 * <p> 240 * {@link GregorianChronology} defines all fields using standard meanings. 241 * It uses the Gregorian calendar rules <i>for all time</i> (proleptic) 242 * thus it is NOT a replacement for <code>GregorianCalendar</code>. 243 * For that purpose, you should use {@link #getGJ()}. 244 * <p> 245 * The Gregorian calendar system defines a leap year every four years, 246 * except that every 100 years is not leap, but every 400 is leap. 247 * <p> 248 * Technically, this chronology is almost identical to the ISO chronology, 249 * thus we recommend using ISOChronology instead, which is the default. 250 * 251 * @param zone the zone to use, null means default zone 252 * @return the Gregorian chronology 253 * @deprecated Use GregorianChronology.getInstance(zone) 254 */ 255 public static Chronology getGregorian(DateTimeZone zone) { 256 return GregorianChronology.getInstance(zone); 257 } 258 259 //----------------------------------------------------------------------- 260 /** 261 * Gets an instance of the JulianChronology in the default zone. 262 * <p> 263 * {@link JulianChronology} defines all fields using standard meanings. 264 * It uses the Julian calendar rules <i>for all time</i> (proleptic). 265 * The Julian calendar system defines a leap year every four years. 266 * 267 * @return the Julian chronology 268 * @deprecated Use JulianChronology.getInstance() 269 */ 270 public static Chronology getJulian() { 271 return JulianChronology.getInstance(); 272 } 273 274 /** 275 * Gets an instance of the JulianChronology in the UTC zone. 276 * <p> 277 * {@link JulianChronology} defines all fields using standard meanings. 278 * It uses the Julian calendar rules <i>for all time</i> (proleptic). 279 * The Julian calendar system defines a leap year every four years. 280 * 281 * @return the Julian chronology 282 * @deprecated Use JulianChronology.getInstanceUTC() 283 */ 284 public static Chronology getJulianUTC() { 285 return JulianChronology.getInstanceUTC(); 286 } 287 288 /** 289 * Gets an instance of the JulianChronology in the specified zone. 290 * <p> 291 * {@link JulianChronology} defines all fields using standard meanings. 292 * It uses the Julian calendar rules <i>for all time</i> (proleptic). 293 * The Julian calendar system defines a leap year every four years. 294 * 295 * @param zone the zone to use, null means default zone 296 * @return the Julian chronology 297 * @deprecated Use JulianChronology.getInstance(zone) 298 */ 299 public static Chronology getJulian(DateTimeZone zone) { 300 return JulianChronology.getInstance(zone); 301 } 302 303 //----------------------------------------------------------------------- 304 /** 305 * Gets an instance of the BuddhistChronology in the default zone. 306 * <p> 307 * {@link BuddhistChronology} defines all fields using standard meanings, 308 * however the year is offset by 543. The chronology cannot be used before 309 * year 1 in the Buddhist calendar. 310 * 311 * @return the Buddhist chronology 312 * @deprecated Use BuddhistChronology.getInstance() 313 */ 314 public static Chronology getBuddhist() { 315 return BuddhistChronology.getInstance(); 316 } 317 318 /** 319 * Gets an instance of the BuddhistChronology in the UTC zone. 320 * <p> 321 * {@link BuddhistChronology} defines all fields using standard meanings, 322 * however the year is offset by 543. The chronology cannot be used before 323 * year 1 in the Buddhist calendar. 324 * 325 * @return the Buddhist chronology 326 * @deprecated Use BuddhistChronology.getInstanceUTC() 327 */ 328 public static Chronology getBuddhistUTC() { 329 return BuddhistChronology.getInstanceUTC(); 330 } 331 332 /** 333 * Gets an instance of the BuddhistChronology in the specified zone. 334 * <p> 335 * {@link BuddhistChronology} defines all fields using standard meanings, 336 * however the year is offset by 543. The chronology cannot be used before 337 * year 1 in the Buddhist calendar. 338 * 339 * @param zone the zone to use, null means default zone 340 * @return the Buddhist chronology 341 * @deprecated Use BuddhistChronology.getInstance(zone) 342 */ 343 public static Chronology getBuddhist(DateTimeZone zone) { 344 return BuddhistChronology.getInstance(zone); 345 } 346 347 //----------------------------------------------------------------------- 348 /** 349 * Gets an instance of the CopticChronology in the default zone. 350 * <p> 351 * {@link CopticChronology} defines fields sensibly for the Coptic calendar system. 352 * The Coptic calendar system defines every fourth year as leap. 353 * The year is broken down into 12 months, each 30 days in length. 354 * An extra period at the end of the year is either 5 or 6 days in length 355 * and is returned as a 13th month. 356 * Year 1 in the Coptic calendar began on August 29, 284 CE (Julian). 357 * The chronology cannot be used before the first Coptic year. 358 * 359 * @return the Coptic chronology 360 * @deprecated Use CopticChronology.getInstance() 361 */ 362 public static Chronology getCoptic() { 363 return CopticChronology.getInstance(); 364 } 365 366 /** 367 * Gets an instance of the CopticChronology in the UTC zone. 368 * <p> 369 * {@link CopticChronology} defines fields sensibly for the Coptic calendar system. 370 * The Coptic calendar system defines every fourth year as leap. 371 * The year is broken down into 12 months, each 30 days in length. 372 * An extra period at the end of the year is either 5 or 6 days in length 373 * and is returned as a 13th month. 374 * Year 1 in the Coptic calendar began on August 29, 284 CE (Julian). 375 * The chronology cannot be used before the first Coptic year. 376 * 377 * @return the Coptic chronology 378 * @deprecated Use CopticChronology.getInstanceUTC() 379 */ 380 public static Chronology getCopticUTC() { 381 return CopticChronology.getInstanceUTC(); 382 } 383 384 /** 385 * Gets an instance of the CopticChronology in the specified zone. 386 * <p> 387 * {@link CopticChronology} defines fields sensibly for the Coptic calendar system. 388 * The Coptic calendar system defines every fourth year as leap. 389 * The year is broken down into 12 months, each 30 days in length. 390 * An extra period at the end of the year is either 5 or 6 days in length 391 * and is returned as a 13th month. 392 * Year 1 in the Coptic calendar began on August 29, 284 CE (Julian). 393 * The chronology cannot be used before the first Coptic year. 394 * 395 * @param zone the zone to use, null means default zone 396 * @return the Coptic chronology 397 * @deprecated Use CopticChronology.getInstance(zone) 398 */ 399 public static Chronology getCoptic(DateTimeZone zone) { 400 return CopticChronology.getInstance(zone); 401 } 402 403 //----------------------------------------------------------------------- 404 /** 405 * Returns the DateTimeZone that this Chronology operates in, or null if 406 * unspecified. 407 * 408 * @return the DateTimeZone, null if unspecified 409 */ 410 public abstract DateTimeZone getZone(); 411 412 /** 413 * Returns an instance of this Chronology that operates in the UTC time 414 * zone. Chronologies that do not operate in a time zone or are already 415 * UTC must return themself. 416 * 417 * @return a version of this chronology that ignores time zones 418 */ 419 public abstract Chronology withUTC(); 420 421 /** 422 * Returns an instance of this Chronology that operates in any time zone. 423 * 424 * @return a version of this chronology with a specific time zone 425 * @param zone to use, or default if null 426 * @see org.joda.time.chrono.ZonedChronology 427 */ 428 public abstract Chronology withZone(DateTimeZone zone); 429 430 /** 431 * Returns a datetime millisecond instant, formed from the given year, 432 * month, day, and millisecond values. The set of given values must refer 433 * to a valid datetime, or else an IllegalArgumentException is thrown. 434 * <p> 435 * The default implementation calls upon separate DateTimeFields to 436 * determine the result. Subclasses are encouraged to provide a more 437 * efficient implementation. 438 * 439 * @param year year to use 440 * @param monthOfYear month to use 441 * @param dayOfMonth day of month to use 442 * @param millisOfDay millisecond to use 443 * @return millisecond instant from 1970-01-01T00:00:00Z 444 * @throws IllegalArgumentException if the values are invalid 445 */ 446 public abstract long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int millisOfDay); 447 448 /** 449 * Returns a datetime millisecond instant, formed from the given year, 450 * month, day, hour, minute, second, and millisecond values. The set of 451 * given values must refer to a valid datetime, or else an 452 * IllegalArgumentException is thrown. 453 * <p> 454 * The default implementation calls upon separate DateTimeFields to 455 * determine the result. Subclasses are encouraged to provide a more 456 * efficient implementation. 457 * 458 * @param year year to use 459 * @param monthOfYear month to use 460 * @param dayOfMonth day of month to use 461 * @param hourOfDay hour to use 462 * @param minuteOfHour minute to use 463 * @param secondOfMinute second to use 464 * @param millisOfSecond millisecond to use 465 * @return millisecond instant from 1970-01-01T00:00:00Z 466 * @throws IllegalArgumentException if the values are invalid 467 */ 468 public abstract long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, 469 int hourOfDay, int minuteOfHour, 470 int secondOfMinute, int millisOfSecond); 471 472 /** 473 * Returns a datetime millisecond instant, from from the given instant, 474 * hour, minute, second, and millisecond values. The set of given values 475 * must refer to a valid datetime, or else an IllegalArgumentException is 476 * thrown. 477 * <p> 478 * The default implementation calls upon separate DateTimeFields to 479 * determine the result. Subclasses are encouraged to provide a more 480 * efficient implementation. 481 * 482 * @param instant instant to start from 483 * @param hourOfDay hour to use 484 * @param minuteOfHour minute to use 485 * @param secondOfMinute second to use 486 * @param millisOfSecond millisecond to use 487 * @return millisecond instant from 1970-01-01T00:00:00Z 488 * @throws IllegalArgumentException if the values are invalid 489 */ 490 public abstract long getDateTimeMillis(long instant, 491 int hourOfDay, int minuteOfHour, 492 int secondOfMinute, int millisOfSecond); 493 494 //----------------------------------------------------------------------- 495 /** 496 * Validates whether the values are valid for the fields of a partial instant. 497 * 498 * @param partial the partial instant to validate 499 * @param values the values to validate, not null, match fields in partial 500 * @throws IllegalArgumentException if the instant is invalid 501 */ 502 public abstract void validate(ReadablePartial partial, int[] values); 503 504 /** 505 * Gets the values of a partial from an instant. 506 * 507 * @param partial the partial instant to use 508 * @param instant the instant to query 509 * @return the values of this partial extracted from the instant 510 */ 511 public abstract int[] get(ReadablePartial partial, long instant); 512 513 /** 514 * Sets the partial into the instant. 515 * 516 * @param partial the partial instant to use 517 * @param instant the instant to update 518 * @return the updated instant 519 */ 520 public abstract long set(ReadablePartial partial, long instant); 521 522 //----------------------------------------------------------------------- 523 /** 524 * Gets the values of a period from an interval. 525 * 526 * @param period the period instant to use 527 * @param startInstant the start instant of an interval to query 528 * @param endInstant the start instant of an interval to query 529 * @return the values of the period extracted from the interval 530 */ 531 public abstract int[] get(ReadablePeriod period, long startInstant, long endInstant); 532 533 /** 534 * Gets the values of a period from an interval. 535 * 536 * @param period the period instant to use 537 * @param duration the duration to query 538 * @return the values of the period extracted from the duration 539 */ 540 public abstract int[] get(ReadablePeriod period, long duration); 541 542 /** 543 * Adds the period to the instant, specifying the number of times to add. 544 * 545 * @param period the period to add, null means add nothing 546 * @param instant the instant to add to 547 * @param scalar the number of times to add 548 * @return the updated instant 549 */ 550 public abstract long add(ReadablePeriod period, long instant, int scalar); 551 552 //----------------------------------------------------------------------- 553 /** 554 * Adds the duration to the instant, specifying the number of times to add. 555 * 556 * @param instant the instant to add to 557 * @param duration the duration to add 558 * @param scalar the number of times to add 559 * @return the updated instant 560 */ 561 public abstract long add(long instant, long duration, int scalar); 562 563 // Millis 564 //----------------------------------------------------------------------- 565 /** 566 * Get the millis duration field for this chronology. 567 * 568 * @return DurationField or UnsupportedDurationField if unsupported 569 */ 570 public abstract DurationField millis(); 571 572 /** 573 * Get the millis of second field for this chronology. 574 * 575 * @return DateTimeField or UnsupportedDateTimeField if unsupported 576 */ 577 public abstract DateTimeField millisOfSecond(); 578 579 /** 580 * Get the millis of day field for this chronology. 581 * 582 * @return DateTimeField or UnsupportedDateTimeField if unsupported 583 */ 584 public abstract DateTimeField millisOfDay(); 585 586 // Second 587 //----------------------------------------------------------------------- 588 /** 589 * Get the seconds duration field for this chronology. 590 * 591 * @return DurationField or UnsupportedDurationField if unsupported 592 */ 593 public abstract DurationField seconds(); 594 595 /** 596 * Get the second of minute field for this chronology. 597 * 598 * @return DateTimeField or UnsupportedDateTimeField if unsupported 599 */ 600 public abstract DateTimeField secondOfMinute(); 601 602 /** 603 * Get the second of day field for this chronology. 604 * 605 * @return DateTimeField or UnsupportedDateTimeField if unsupported 606 */ 607 public abstract DateTimeField secondOfDay(); 608 609 // Minute 610 //----------------------------------------------------------------------- 611 /** 612 * Get the minutes duration field for this chronology. 613 * 614 * @return DurationField or UnsupportedDurationField if unsupported 615 */ 616 public abstract DurationField minutes(); 617 618 /** 619 * Get the minute of hour field for this chronology. 620 * 621 * @return DateTimeField or UnsupportedDateTimeField if unsupported 622 */ 623 public abstract DateTimeField minuteOfHour(); 624 625 /** 626 * Get the minute of day field for this chronology. 627 * 628 * @return DateTimeField or UnsupportedDateTimeField if unsupported 629 */ 630 public abstract DateTimeField minuteOfDay(); 631 632 // Hour 633 //----------------------------------------------------------------------- 634 /** 635 * Get the hours duration field for this chronology. 636 * 637 * @return DurationField or UnsupportedDurationField if unsupported 638 */ 639 public abstract DurationField hours(); 640 641 /** 642 * Get the hour of day (0-23) field for this chronology. 643 * 644 * @return DateTimeField or UnsupportedDateTimeField if unsupported 645 */ 646 public abstract DateTimeField hourOfDay(); 647 648 /** 649 * Get the hour of day (offset to 1-24) field for this chronology. 650 * 651 * @return DateTimeField or UnsupportedDateTimeField if unsupported 652 */ 653 public abstract DateTimeField clockhourOfDay(); 654 655 // Halfday 656 //----------------------------------------------------------------------- 657 /** 658 * Get the halfdays duration field for this chronology. 659 * 660 * @return DurationField or UnsupportedDurationField if unsupported 661 */ 662 public abstract DurationField halfdays(); 663 664 /** 665 * Get the hour of am/pm (0-11) field for this chronology. 666 * 667 * @return DateTimeField or UnsupportedDateTimeField if unsupported 668 */ 669 public abstract DateTimeField hourOfHalfday(); 670 671 /** 672 * Get the hour of am/pm (offset to 1-12) field for this chronology. 673 * 674 * @return DateTimeField or UnsupportedDateTimeField if unsupported 675 */ 676 public abstract DateTimeField clockhourOfHalfday(); 677 678 /** 679 * Get the AM(0) PM(1) field for this chronology. 680 * 681 * @return DateTimeField or UnsupportedDateTimeField if unsupported 682 */ 683 public abstract DateTimeField halfdayOfDay(); 684 685 // Day 686 //----------------------------------------------------------------------- 687 /** 688 * Get the days duration field for this chronology. 689 * 690 * @return DurationField or UnsupportedDurationField if unsupported 691 */ 692 public abstract DurationField days(); 693 694 /** 695 * Get the day of week field for this chronology. 696 * 697 * <p>DayOfWeek values are defined in {@link DateTimeConstants}. 698 * They use the ISO definitions, where 1 is Monday and 7 is Sunday. 699 * 700 * @return DateTimeField or UnsupportedDateTimeField if unsupported 701 */ 702 public abstract DateTimeField dayOfWeek(); 703 704 /** 705 * Get the day of month field for this chronology. 706 * 707 * @return DateTimeField or UnsupportedDateTimeField if unsupported 708 */ 709 public abstract DateTimeField dayOfMonth(); 710 711 /** 712 * Get the day of year field for this chronology. 713 * 714 * @return DateTimeField or UnsupportedDateTimeField if unsupported 715 */ 716 public abstract DateTimeField dayOfYear(); 717 718 // Week 719 //----------------------------------------------------------------------- 720 /** 721 * Get the weeks duration field for this chronology. 722 * 723 * @return DurationField or UnsupportedDurationField if unsupported 724 */ 725 public abstract DurationField weeks(); 726 727 /** 728 * Get the week of a week based year field for this chronology. 729 * 730 * @return DateTimeField or UnsupportedDateTimeField if unsupported 731 */ 732 public abstract DateTimeField weekOfWeekyear(); 733 734 // Weekyear 735 //----------------------------------------------------------------------- 736 /** 737 * Get the weekyears duration field for this chronology. 738 * 739 * @return DurationField or UnsupportedDurationField if unsupported 740 */ 741 public abstract DurationField weekyears(); 742 743 /** 744 * Get the year of a week based year field for this chronology. 745 * 746 * @return DateTimeField or UnsupportedDateTimeField if unsupported 747 */ 748 public abstract DateTimeField weekyear(); 749 750 /** 751 * Get the year of a week based year in a century field for this chronology. 752 * 753 * @return DateTimeField or UnsupportedDateTimeField if unsupported 754 */ 755 public abstract DateTimeField weekyearOfCentury(); 756 757 // Month 758 //----------------------------------------------------------------------- 759 /** 760 * Get the months duration field for this chronology. 761 * 762 * @return DurationField or UnsupportedDurationField if unsupported 763 */ 764 public abstract DurationField months(); 765 766 /** 767 * Get the month of year field for this chronology. 768 * 769 * @return DateTimeField or UnsupportedDateTimeField if unsupported 770 */ 771 public abstract DateTimeField monthOfYear(); 772 773 // Year 774 //----------------------------------------------------------------------- 775 /** 776 * Get the years duration field for this chronology. 777 * 778 * @return DurationField or UnsupportedDurationField if unsupported 779 */ 780 public abstract DurationField years(); 781 782 /** 783 * Get the year field for this chronology. 784 * 785 * @return DateTimeField or UnsupportedDateTimeField if unsupported 786 */ 787 public abstract DateTimeField year(); 788 789 /** 790 * Get the year of era field for this chronology. 791 * 792 * @return DateTimeField or UnsupportedDateTimeField if unsupported 793 */ 794 public abstract DateTimeField yearOfEra(); 795 796 /** 797 * Get the year of century field for this chronology. 798 * 799 * @return DateTimeField or UnsupportedDateTimeField if unsupported 800 */ 801 public abstract DateTimeField yearOfCentury(); 802 803 // Century 804 //----------------------------------------------------------------------- 805 /** 806 * Get the centuries duration field for this chronology. 807 * 808 * @return DurationField or UnsupportedDurationField if unsupported 809 */ 810 public abstract DurationField centuries(); 811 812 /** 813 * Get the century of era field for this chronology. 814 * 815 * @return DateTimeField or UnsupportedDateTimeField if unsupported 816 */ 817 public abstract DateTimeField centuryOfEra(); 818 819 // Era 820 //----------------------------------------------------------------------- 821 /** 822 * Get the eras duration field for this chronology. 823 * 824 * @return DurationField or UnsupportedDurationField if unsupported 825 */ 826 public abstract DurationField eras(); 827 828 /** 829 * Get the era field for this chronology. 830 * 831 * @return DateTimeField or UnsupportedDateTimeField if unsupported 832 */ 833 public abstract DateTimeField era(); 834 835 //----------------------------------------------------------------------- 836 /** 837 * Gets a debugging toString. 838 * 839 * @return a debugging string 840 */ 841 public abstract String toString(); 842 843 }