| Home >> All >> org >> joda |
| | org.joda.example.* (5) | | org.joda.time.* (261) |
Package Samples:
org.joda.time.tz: Provides support for dates, times, time zones, durations, intervals, and partials.
org.joda.example.time
org.joda.time.base
org.joda.time.chrono
org.joda.time.convert
org.joda.time.field
org.joda.time.format
org.joda.time
org.joda.time.chrono.gj
Classes:
DateTimeFormat: Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting is performed by the DateTimeFormatter class. Three classes provide factory methods to create formatters, and this is one. The others are ISODateTimeFormat and DateTimeFormatterBuilder . This class provides two types of factory: Pattern 55 provides a DateTimeFormatter based on a pattern string that is compatible with the JDK date patterns. Style 55 provides a DateTimeFormatter based on a two character style, representing short, medium, long and full. For example, to use a patterm: DateTime dt = new ...
DateTimeFormatter: Controls the printing and parsing of a datetime to and from a string. This class is the main API for printing and parsing used by most applications. Instances of this class are created via one of three factory classes: DateTimeFormat - formats by pattern and style ISODateTimeFormat - ISO8601 formats DateTimeFormatterBuilder - complex formats created via method calls An instance of this class holds a reference internally to one printer and one parser. It is possible that one of these may be null, in which case the formatter cannot print/parse. This can be checked via the isPrinter() 55 and isParser() ...
DateTimeZoneBuilder: DateTimeZoneBuilder allows complex DateTimeZones to be constructed. Since creating a new DateTimeZone this way is a relatively expensive operation, built zones can be written to a file. Reading back the encoded data is a quick operation. DateTimeZoneBuilder itself is mutable and not thread-safe, but the DateTimeZone objects that it builds are thread-safe and immutable. It is intended that ZoneInfoCompiler be used to read time zone data files, indirectly calling DateTimeZoneBuilder. The following complex example defines the America/Los_Angeles time zone, with all historical transitions: DateTimeZone ...
PeriodFormatter: Controls the printing and parsing of a time period to and from a string. This class is the main API for printing and parsing used by most applications. Instances of this class are created via one of three factory classes: PeriodFormat - formats by pattern and style ISOPeriodFormat - ISO8601 formats PeriodFormatterBuilder - complex formats created via method calls An instance of this class holds a reference internally to one printer and one parser. It is possible that one of these may be null, in which case the formatter cannot print/parse. This can be checked via the isPrinter() 55 and isParser() ...
GJChronology: Implements the Gregorian/Julian calendar system which is the calendar system used in most of the world. Wherever possible, it is recommended to use the ISOChronology instead. The Gregorian calendar replaced the Julian calendar, and the point in time when this chronology switches can be controlled using the second parameter of the getInstance method. By default this cutover is set to the date the Gregorian calendar was first instituted, October 15, 1582. Before this date, this chronology uses the proleptic Julian calendar (proleptic means extending indefinitely). The Julian calendar has leap years ...
ISODateTimeFormat: Factory that creates instances of DateTimeFormatter for the ISO8601 standard. Datetime formatting is performed by the DateTimeFormatter class. Three classes provide factory methods to create formatters, and this is one. The others are DateTimeFormat and DateTimeFormatterBuilder . ISO8601 is the international standard for data interchange. It defines a framework, rather than an absolute standard. As a result this provider has a number of methods that represent common uses of the framework. The most common formats are date 55 , time 55 , and dateTime 55 . For example, to format a date time in ISO ...
DateTimeZone: DateTimeZone represents a time zone. A time zone is a system of rules to convert time from one geographic location to another. For example, Paris, France is one hour ahead of London, England. Thus when it is 10:00 in London, it is 11:00 in Paris. All time zone rules are expressed, for historical reasons, relative to Greenwich, London. Local time in Greenwich is referred to as Greenwich Mean Time (GMT). This is similar, but not precisely identical, to Universal Coordinated Time, or UTC. This library only uses the term UTC. Using this system, America/Los_Angeles is expressed as UTC-08:00, or UTC-07:00 ...
Partial: Partial is an immutable partial datetime supporting any set of datetime fields. A Partial instance can be used to hold any combination of fields. The instance does not contain a time zone, so any datetime is local. A Partial can be matched against an instant using isMatch(ReadableInstant) 55 . This method compares each field on this partial with those of the instant and determines if the partial matches the instant. Given this definition, an empty Partial instance represents any datetime and always matches. Calculations on Partial are performed using a Chronology . This chronology is set to be ...
DateMidnight: DateMidnight defines a date where the time component is fixed at midnight. The class uses a time zone, thus midnight is local unless a UTC time zone is used. It is important to emphasise that this class represents the time of midnight on any given day. Note that midnight is defined as 00:00, which is at the very start of a day. This class does not represent a day, but the millisecond instant at midnight. If you need a class that represents the whole day, then an Interval or a YearMonthDay may be more suitable. This class uses a Chronology internally. The Chronology determines how the millisecond ...
Period: An immutable time period specifying a set of duration field values. A time period is divided into a number of fields, such as hours and seconds. Which fields are supported is defined by the PeriodType class. The default is the standard period type, which supports years, months, weeks, days, hours, minutes, seconds and millis. When this time period is added to an instant, the effect is of adding each field in turn. As a result, this takes into account daylight savings time. Adding a time period of 1 day to the day before daylight savings starts will only add 23 hours rather than 24 to ensure that ...
ConverterManager: ConverterManager controls the date and time converters. This class enables additional conversion classes to be added via addInstantConverter(InstantConverter) 55 , which may replace an existing converter. Similar methods exist for duration, time period and interval converters. This class is threadsafe, so adding/removing converters can be done at any time. Updating the set of convertors is relatively expensive, and so should not be performed often. The default instant converters are: ReadableInstant String Calendar Date (includes sql package subclasses) Long (milliseconds) null (now) The default ...
Chronology: Chronology provides access to the individual date time fields for a chronological calendar system. Various chronologies are supported by subclasses including ISO and GregorianJulian. This class provides static factory methods to access these chronologies. For example, to obtain the current time in the coptic calendar system: DateTime dt = new DateTime(Chronology.getCoptic()); The provided chronology implementations are: ISO - Based on the ISO8601 standard and suitable for use after about 1600 GJ - Historically accurate calendar with Julian followed by Gregorian Gregorian - The Gregorian calendar ...
MutablePeriod: Standard mutable time period implementation. A time period is divided into a number of fields, such as hours and seconds. Which fields are supported is defined by the PeriodType class. The default is the standard period type, which supports years, months, weeks, days, hours, minutes, seconds and millis. When this time period is added to an instant, the effect is of adding each field in turn. As a result, this takes into account daylight savings time. Adding a time period of 1 day to the day before daylight savings starts will only add 23 hours rather than 24 to ensure that the time remains the ...
PeriodFormatterBuilder: Factory that creates complex instances of PeriodFormatter via method calls. Period formatting is performed by the PeriodFormatter class. Three classes provide factory methods to create formatters, and this is one. The others are PeriodFormat and ISOPeriodFormat . PeriodFormatterBuilder is used for constructing formatters which are then used to print or parse. The formatters are built by appending specific fields or other formatters to an instanece of this builder. For example, a formatter that prints years and months, like "15 years and 8 months", can be constructed as follows: PeriodFormatter ...
DateTimeFormatterBuilder: Factory that creates complex instances of DateTimeFormatter via method calls. Datetime formatting is performed by the DateTimeFormatter class. Three classes provide factory methods to create formatters, and this is one. The others are DateTimeFormat and ISODateTimeFormat . DateTimeFormatterBuilder is used for constructing formatters which are then used to print or parse. The formatters are built by appending specific fields or other formatters to an instanece of this builder. For example, a formatter that prints month and year, like "January 1970", can be constructed as follows: DateTimeFormatter ...
MutableInterval: MutableInterval is the standard implementation of a mutable time interval. A time interval represents a period of time between two instants. Intervals are inclusive of the start instant and exclusive of the end. The end instant is always greater than or equal to the start instant. Intervals have a fixed millisecond duration. This is the difference between the start and end instants. The duration is represented separately by ReadableDuration . As a result, intervals are not comparable. To compare the length of two intervals, you should compare their durations. An interval can also be converted to ...
YearMonthDay: YearMonthDay is an immutable partial supporting the year, monthOfYear and dayOfMonth fields. Calculations on YearMonthDay are performed using a Chronology . This chronology is set to be in the UTC time zone for all calculations. Each individual field can be queried in two ways: getMonthOfYear() monthOfYear().get() The second technique also provides access to other useful methods on the field: numeric value - monthOfYear().get() text value - monthOfYear().getAsText() short text value - monthOfYear().getAsShortText() maximum/minimum values - monthOfYear().getMaximumValue() add/subtract - monthOfYear().addToCopy() ...
ReadableInterval: Readable interface for an interval of time between two instants. A time interval represents a period of time between two instants. Intervals are inclusive of the start instant and exclusive of the end. The end instant is always greater than or equal to the start instant. Intervals have a fixed millisecond duration. This is the difference between the start and end instants. The duration is represented separately by ReadableDuration . As a result, intervals are not comparable. To compare the length of two intervals, you should compare their durations. An interval can also be converted to a ReadablePeriod ...
TimeOfDay: TimeOfDay is an immutable partial supporting the hour, minute, second and millisecond fields. Calculations on TimeOfDay are performed using a Chronology . This chronology is set to be in the UTC time zone for all calculations. Each individual field can be queried in two ways: getHourOfDay() hourOfDay().get() The second technique also provides access to other useful methods on the field: numeric value - hourOfDay().get() text value - hourOfDay().getAsText() short text value - hourOfDay().getAsShortText() maximum/minimum values - hourOfDay().getMaximumValue() add/subtract - hourOfDay().addToCopy() ...
DateTimeFieldType: Identifies a field, such as year or minuteOfHour, in a chronology-neutral way. A field type defines the type of the field, such as hourOfDay. If does not directly enable any calculations, however it does provide a getField(Chronology) 55 method that returns the actual calculation engine for a particular chronology. It also provides access to the related DurationFieldType s. Instances of DateTimeFieldType are singletons. They can be compared using == . If required, you can create your own field, for example a quarterOfYear. You must create a subclass of DateTimeFieldType that defines the field type. ...
MutableDateTime: MutableDateTime is the standard implementation of a modifiable datetime class. It holds the datetime as milliseconds from the Java epoch of 1970-01-01T00:00:00Z. This class uses a Chronology internally. The Chronology determines how the millisecond instant value is converted into the date time fields. The default Chronology is ISOChronology which is the agreed international standard and compatable with the modern Gregorian calendar. Each individual field can be accessed in two ways: getHourOfDay() hourOfDay().get() The second technique also provides access to other useful methods on the field: ...
JodaTimePermission: JodaTimePermission is used for securing global method calls in the Joda-Time library. Since this class extends BasicPermission, asterisks may be used to denote wildcard permissions. The following permissions are supported: DateTimeZone .setDefault Allows a default DateTimeZone to be set .setProvider Allows the DateTimeZone instance provider to be set .setNameProvider Allows the DateTimeZone name provider to be set ConverterManager .alterInstantConverters Allows an instant converter to be added or removed .alterPartialConverters Allows a partial converter to be added or removed .alterDurationConverters ...
DateTimeParserBucket: DateTimeParserBucket is an advanced class, intended mainly for parser implementations. It can also be used during normal parsing operations to capture more information about the parse. This class allows fields to be saved in any order, but be physically set in a consistent order. This is useful for parsing against formats that allow field values to contradict each other. Field values are applied in an order where the "larger" fields are set first, making their value less likely to stick. A field is larger than another when it's range duration is longer. If both ranges are the same, then the larger ...
MainTest: Tests either the Julian or Gregorian chronology from org.joda.time.chrono.gj against the implementations in this package. It tests all the date fields against their principal methods. Randomly generated values are fed into the DateTimeField methods and the results are compared between the two chronologies. If any result doesn't match, an error report is generated and the program exits. Each time this test program is run, the pseudo random number generator is seeded with the same value. This ensures consistent results between test runs. The main method accepts three optional arguments: iterations, ...
ReadablePeriod: Defines a time period specified in terms of individual duration fields such as years and days. The implementation of this interface may be mutable or immutable. This interface only gives access to retrieve data, never to change it. Periods are split up into multiple fields, for example days and seconds. Implementations are not required to evenly distribute the values across the fields. The value for each field may be positive or negative. When a time period is added to an instant, the effect is to add each field in turn. For example, a time period could be defined as 3 months, 2 days and -1 hours. ...
| Home | Contact Us | Privacy Policy | Terms of Service |