Java Doc for DateTime.java in  » Development » Joda-Time » org » joda » time » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » Joda Time » org.joda.time 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.joda.time.base.BaseDateTime
   org.joda.time.DateTime

DateTime
final public class DateTime extends BaseDateTime implements ReadableDateTime,Serializable(Code)
DateTime is the standard implementation of an unmodifiable datetime class.

DateTime is the most widely used implementation of ReadableInstant . As with all instants, it represents an exact point on the time-line, but limited to the precision of milliseconds. A DateTime calculates its fields with respect to a DateTimeZone time zone .

Internally, the class holds two pieces of data. Firstly, it holds the datetime as milliseconds from the Java epoch of 1970-01-01T00:00:00Z. Secondly, it holds a Chronology which 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 compatible with the modern Gregorian calendar.

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
  • text value
  • short text value
  • maximum/minimum values
  • add/subtract
  • set
  • rounding

DateTime is thread-safe and immutable, provided that the Chronology is as well. All standard Chronology classes supplied are thread-safe and immutable.
author:
   Stephen Colebourne
author:
   Kandarp Shah
author:
   Brian S O'Neill
since:
   1.0
See Also:   MutableDateTime


Inner Class :final public static class Property extends AbstractReadableInstantFieldProperty


Constructor Summary
public  DateTime()
     Constructs an instance set to the current system millisecond time using ISOChronology in the default time zone.
public  DateTime(DateTimeZone zone)
     Constructs an instance set to the current system millisecond time using ISOChronology in the specified time zone.
public  DateTime(Chronology chronology)
     Constructs an instance set to the current system millisecond time using the specified chronology.
public  DateTime(long instant)
     Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using ISOChronology in the default time zone.
public  DateTime(long instant, DateTimeZone zone)
     Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using ISOChronology in the specified time zone.
public  DateTime(long instant, Chronology chronology)
     Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using the specified chronology.
public  DateTime(Object instant)
     Constructs an instance from an Object that represents a datetime.

If the object implies a chronology (such as GregorianCalendar does), then that chronology will be used.

public  DateTime(Object instant, DateTimeZone zone)
     Constructs an instance from an Object that represents a datetime, forcing the time zone to that specified.
public  DateTime(Object instant, Chronology chronology)
     Constructs an instance from an Object that represents a datetime, using the specified chronology.
public  DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
     Constructs an instance from datetime field values using ISOChronology in the default time zone.
public  DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, DateTimeZone zone)
     Constructs an instance from datetime field values using ISOChronology in the specified time zone.
public  DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, Chronology chronology)
     Constructs an instance from datetime field values using the specified chronology.

Method Summary
public  PropertycenturyOfEra()
     Get the century of era property which provides access to advanced functionality.
public  PropertydayOfMonth()
     Get the day of month property which provides access to advanced functionality.
public  PropertydayOfWeek()
     Get the day of week property which provides access to advanced functionality.
public  PropertydayOfYear()
     Get the day of year property which provides access to advanced functionality.
public  Propertyera()
     Get the era property which provides access to advanced functionality.
public  PropertyhourOfDay()
     Get the hour of day field property which provides access to advanced functionality.
public  PropertymillisOfDay()
     Get the millis of day property which provides access to advanced functionality.
public  PropertymillisOfSecond()
     Get the millis of second property which provides access to advanced functionality.
public  DateTimeminus(long duration)
     Returns a copy of this datetime with the specified duration taken away.
public  DateTimeminus(ReadableDuration duration)
     Returns a copy of this datetime with the specified duration taken away.
public  DateTimeminus(ReadablePeriod period)
     Returns a copy of this datetime with the specified period taken away.
public  DateTimeminusDays(int days)
     Returns a copy of this datetime minus the specified number of days.

The calculation will do its best to only change the day field retaining the same time of day. However, in certain circumstances, typically daylight savings cutover, it may be necessary to alter the time fields.

In spring an hour is typically removed.

public  DateTimeminusHours(int hours)
     Returns a copy of this datetime minus the specified number of hours.

The calculation will subtract a duration equivalent to the number of hours expressed in milliseconds.

For example, if a spring daylight savings cutover is from 01:59 to 03:00 then subtracting one hour from 03:30 will result in 01:30.

public  DateTimeminusMillis(int millis)
     Returns a copy of this datetime minus the specified number of millis.
public  DateTimeminusMinutes(int minutes)
     Returns a copy of this datetime minus the specified number of minutes.
public  DateTimeminusMonths(int months)
     Returns a copy of this datetime minus the specified number of months.

The calculation will do its best to only change the month field retaining the same day of month. However, in certain circumstances, it may be necessary to alter smaller fields.

public  DateTimeminusSeconds(int seconds)
     Returns a copy of this datetime minus the specified number of seconds.
public  DateTimeminusWeeks(int weeks)
     Returns a copy of this datetime minus the specified number of weeks.
public  DateTimeminusYears(int years)
     Returns a copy of this datetime minus the specified number of years.

The calculation will do its best to only change the year field retaining the same month of year. However, in certain circumstances, it may be necessary to alter smaller fields.

public  PropertyminuteOfDay()
     Get the minute of day property which provides access to advanced functionality.
public  PropertyminuteOfHour()
     Get the minute of hour field property which provides access to advanced functionality.
public  PropertymonthOfYear()
     Get the month of year property which provides access to advanced functionality.
public  DateTimeplus(long duration)
     Returns a copy of this datetime with the specified duration added.
public  DateTimeplus(ReadableDuration duration)
     Returns a copy of this datetime with the specified duration added.
public  DateTimeplus(ReadablePeriod period)
     Returns a copy of this datetime with the specified period added.
public  DateTimeplusDays(int days)
     Returns a copy of this datetime plus the specified number of days.

The calculation will do its best to only change the day field retaining the same time of day. However, in certain circumstances, typically daylight savings cutover, it may be necessary to alter the time fields.

In spring an hour is typically removed.

public  DateTimeplusHours(int hours)
     Returns a copy of this datetime plus the specified number of hours.

The calculation will add a duration equivalent to the number of hours expressed in milliseconds.

For example, if a spring daylight savings cutover is from 01:59 to 03:00 then adding one hour to 01:30 will result in 03:30.

public  DateTimeplusMillis(int millis)
     Returns a copy of this datetime plus the specified number of millis.
public  DateTimeplusMinutes(int minutes)
     Returns a copy of this datetime plus the specified number of minutes.
public  DateTimeplusMonths(int months)
     Returns a copy of this datetime plus the specified number of months.

The calculation will do its best to only change the month field retaining the same day of month. However, in certain circumstances, it may be necessary to alter smaller fields.

public  DateTimeplusSeconds(int seconds)
     Returns a copy of this datetime plus the specified number of seconds.
public  DateTimeplusWeeks(int weeks)
     Returns a copy of this datetime plus the specified number of weeks.
public  DateTimeplusYears(int years)
     Returns a copy of this datetime plus the specified number of years.

The calculation will do its best to only change the year field retaining the same month of year. However, in certain circumstances, it may be necessary to alter smaller fields.

public  Propertyproperty(DateTimeFieldType type)
     Gets the property object for the specified type, which contains many useful methods.
public  PropertysecondOfDay()
     Get the second of day property which provides access to advanced functionality.
public  PropertysecondOfMinute()
     Get the second of minute field property which provides access to advanced functionality.
public  DateMidnighttoDateMidnight()
     Converts this object to a DateMidnight using the same millis and chronology.
public  DateTimetoDateTime()
     Get this object as a DateTime by returning this.
public  DateTimetoDateTime(DateTimeZone zone)
     Get this object as a DateTime, returning this if possible.
public  DateTimetoDateTime(Chronology chronology)
     Get this object as a DateTime, returning this if possible.
public  DateTimetoDateTimeISO()
     Get this object as a DateTime using ISOChronology in the default zone, returning this if possible.
public  LocalDatetoLocalDate()
     Converts this object to a LocalDate with the same date and chronology.
public  LocalDateTimetoLocalDateTime()
     Converts this object to a LocalDateTime with the same datetime and chronology.
public  LocalTimetoLocalTime()
     Converts this object to a LocalTime with the same time and chronology.
public  TimeOfDaytoTimeOfDay()
     Converts this object to a TimeOfDay using the same millis and chronology.
public  YearMonthDaytoYearMonthDay()
     Converts this object to a YearMonthDay using the same millis and chronology.
public  PropertyweekOfWeekyear()
     Get the week of a week based year property which provides access to advanced functionality.
public  Propertyweekyear()
     Get the year of a week based year property which provides access to advanced functionality.
public  DateTimewithCenturyOfEra(int centuryOfEra)
     Returns a copy of this datetime with the century of era field updated.
public  DateTimewithChronology(Chronology newChronology)
     Returns a copy of this datetime with a different chronology.
public  DateTimewithDate(int year, int monthOfYear, int dayOfMonth)
     Returns a copy of this datetime with the specified date, retaining the time fields.
public  DateTimewithDayOfMonth(int dayOfMonth)
     Returns a copy of this datetime with the day of month field updated.
public  DateTimewithDayOfWeek(int dayOfWeek)
     Returns a copy of this datetime with the day of week field updated.
public  DateTimewithDayOfYear(int dayOfYear)
     Returns a copy of this datetime with the day of year field updated.
public  DateTimewithDurationAdded(long durationToAdd, int scalar)
     Returns a copy of this datetime with the specified duration added.
public  DateTimewithDurationAdded(ReadableDuration durationToAdd, int scalar)
     Returns a copy of this datetime with the specified duration added.
public  DateTimewithEra(int era)
     Returns a copy of this datetime with the era field updated.
public  DateTimewithField(DateTimeFieldType fieldType, int value)
     Returns a copy of this datetime with the specified field set to a new value.
public  DateTimewithFieldAdded(DurationFieldType fieldType, int amount)
     Returns a copy of this datetime with the value of the specified field increased.
public  DateTimewithFields(ReadablePartial partial)
     Returns a copy of this datetime with the partial set of fields replacing those from this instance.
public  DateTimewithHourOfDay(int hour)
     Returns a copy of this datetime with the hour of day field updated.
public  DateTimewithMillis(long newMillis)
     Returns a copy of this datetime with different millis.
public  DateTimewithMillisOfDay(int millis)
     Returns a copy of this datetime with the millis of day field updated.
public  DateTimewithMillisOfSecond(int millis)
     Returns a copy of this datetime with the millis of second field updated.
public  DateTimewithMinuteOfHour(int minute)
     Returns a copy of this datetime with the minute of hour updated.
public  DateTimewithMonthOfYear(int monthOfYear)
     Returns a copy of this datetime with the month of year field updated.
public  DateTimewithPeriodAdded(ReadablePeriod period, int scalar)
     Returns a copy of this datetime with the specified period added.

If the addition is zero, then this is returned.

This method is typically used to add multiple copies of complex period instances.

public  DateTimewithSecondOfMinute(int second)
     Returns a copy of this datetime with the second of minute field updated.
public  DateTimewithTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
     Returns a copy of this datetime with the specified time, retaining the date fields.
public  DateTimewithWeekOfWeekyear(int weekOfWeekyear)
     Returns a copy of this datetime with the week of weekyear field updated.
public  DateTimewithWeekyear(int weekyear)
     Returns a copy of this datetime with the weekyear field updated.
public  DateTimewithYear(int year)
     Returns a copy of this datetime with the year field updated.
public  DateTimewithYearOfCentury(int yearOfCentury)
     Returns a copy of this datetime with the year of century field updated.
public  DateTimewithYearOfEra(int yearOfEra)
     Returns a copy of this datetime with the year of era field updated.
public  DateTimewithZone(DateTimeZone newZone)
     Returns a copy of this datetime with a different time zone, preserving the millisecond instant.
public  DateTimewithZoneRetainFields(DateTimeZone newZone)
     Returns a copy of this datetime with a different time zone, preserving the field values.

This method is useful for finding the millisecond time in another timezone. For example, if this instant holds 12:30 in Europe/London (ie.

public  Propertyyear()
     Get the year property which provides access to advanced functionality.
public  PropertyyearOfCentury()
     Get the year of century property which provides access to advanced functionality.
public  PropertyyearOfEra()
     Get the year of era property which provides access to advanced functionality.


Constructor Detail
DateTime
public DateTime()(Code)
Constructs an instance set to the current system millisecond time using ISOChronology in the default time zone.



DateTime
public DateTime(DateTimeZone zone)(Code)
Constructs an instance set to the current system millisecond time using ISOChronology in the specified time zone.

If the specified time zone is null, the default zone is used.
Parameters:
  zone - the time zone, null means default zone




DateTime
public DateTime(Chronology chronology)(Code)
Constructs an instance set to the current system millisecond time using the specified chronology.

If the chronology is null, ISOChronology in the default time zone is used.
Parameters:
  chronology - the chronology, null means ISOChronology in default zone




DateTime
public DateTime(long instant)(Code)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using ISOChronology in the default time zone.
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z



DateTime
public DateTime(long instant, DateTimeZone zone)(Code)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using ISOChronology in the specified time zone.

If the specified time zone is null, the default zone is used.
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z
Parameters:
  zone - the time zone, null means default zone




DateTime
public DateTime(long instant, Chronology chronology)(Code)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using the specified chronology.

If the chronology is null, ISOChronology in the default time zone is used.
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z
Parameters:
  chronology - the chronology, null means ISOChronology in default zone




DateTime
public DateTime(Object instant)(Code)
Constructs an instance from an Object that represents a datetime.

If the object implies a chronology (such as GregorianCalendar does), then that chronology will be used. Otherwise, ISO default is used. Thus if a GregorianCalendar is passed in, the chronology used will be GJ, but if a Date is passed in the chronology will be ISO.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadableInstant, String, Calendar and Date. The String formats are described by ISODateTimeFormat.dateTimeParser .
Parameters:
  instant - the datetime object, null means now
throws:
  IllegalArgumentException - if the instant is invalid




DateTime
public DateTime(Object instant, DateTimeZone zone)(Code)
Constructs an instance from an Object that represents a datetime, forcing the time zone to that specified.

If the object implies a chronology (such as GregorianCalendar does), then that chronology will be used, but with the time zone adjusted. Otherwise, ISO is used in the specified time zone. If the specified time zone is null, the default zone is used. Thus if a GregorianCalendar is passed in, the chronology used will be GJ, but if a Date is passed in the chronology will be ISO.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadableInstant, String, Calendar and Date. The String formats are described by ISODateTimeFormat.dateTimeParser .
Parameters:
  instant - the datetime object, null means now
Parameters:
  zone - the time zone, null means default time zone
throws:
  IllegalArgumentException - if the instant is invalid




DateTime
public DateTime(Object instant, Chronology chronology)(Code)
Constructs an instance from an Object that represents a datetime, using the specified chronology.

If the chronology is null, ISO in the default time zone is used. Any chronology implied by the object (such as GregorianCalendar does) is ignored.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadableInstant, String, Calendar and Date. The String formats are described by ISODateTimeFormat.dateTimeParser .
Parameters:
  instant - the datetime object, null means now
Parameters:
  chronology - the chronology, null means ISO in default zone
throws:
  IllegalArgumentException - if the instant is invalid




DateTime
public DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)(Code)
Constructs an instance from datetime field values using ISOChronology in the default time zone.
Parameters:
  year - the year
Parameters:
  monthOfYear - the month of the year
Parameters:
  dayOfMonth - the day of the month
Parameters:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour
Parameters:
  secondOfMinute - the second of the minute
Parameters:
  millisOfSecond - the millisecond of the second



DateTime
public DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, DateTimeZone zone)(Code)
Constructs an instance from datetime field values using ISOChronology in the specified time zone.

If the specified time zone is null, the default zone is used.
Parameters:
  year - the year
Parameters:
  monthOfYear - the month of the year
Parameters:
  dayOfMonth - the day of the month
Parameters:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour
Parameters:
  secondOfMinute - the second of the minute
Parameters:
  millisOfSecond - the millisecond of the second
Parameters:
  zone - the time zone, null means default time zone




DateTime
public DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, Chronology chronology)(Code)
Constructs an instance from datetime field values using the specified chronology.

If the chronology is null, ISOChronology in the default time zone is used.
Parameters:
  year - the year
Parameters:
  monthOfYear - the month of the year
Parameters:
  dayOfMonth - the day of the month
Parameters:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour
Parameters:
  secondOfMinute - the second of the minute
Parameters:
  millisOfSecond - the millisecond of the second
Parameters:
  chronology - the chronology, null means ISOChronology in default zone





Method Detail
centuryOfEra
public Property centuryOfEra()(Code)
Get the century of era property which provides access to advanced functionality. the year of era property



dayOfMonth
public Property dayOfMonth()(Code)
Get the day of month property which provides access to advanced functionality. the day of month property



dayOfWeek
public Property dayOfWeek()(Code)
Get the day of week property which provides access to advanced functionality. the day of week property



dayOfYear
public Property dayOfYear()(Code)
Get the day of year property which provides access to advanced functionality. the day of year property



era
public Property era()(Code)
Get the era property which provides access to advanced functionality. the era property



hourOfDay
public Property hourOfDay()(Code)
Get the hour of day field property which provides access to advanced functionality. the hour of day property



millisOfDay
public Property millisOfDay()(Code)
Get the millis of day property which provides access to advanced functionality. the millis of day property



millisOfSecond
public Property millisOfSecond()(Code)
Get the millis of second property which provides access to advanced functionality. the millis of second property



minus
public DateTime minus(long duration)(Code)
Returns a copy of this datetime with the specified duration taken away.

If the amount is zero or null, then this is returned. This datetime instance is immutable and unaffected by this method call.
Parameters:
  duration - the duration, in millis, to reduce this instant by a copy of this datetime with the duration taken away
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




minus
public DateTime minus(ReadableDuration duration)(Code)
Returns a copy of this datetime with the specified duration taken away.

If the amount is zero or null, then this is returned. This datetime instance is immutable and unaffected by this method call.
Parameters:
  duration - the duration to reduce this instant by a copy of this datetime with the duration taken away
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




minus
public DateTime minus(ReadablePeriod period)(Code)
Returns a copy of this datetime with the specified period taken away.

This method will subtract each element of the period one by one, from largest to smallest, adjusting the datetime to be accurate between each.

Thus, subtracting a period of one month and one day from 2007-05-31 will work as follows: First subtract one month and adjust, resulting in 2007-04-30 Then subtract one day and adjust, resulting in 2007-04-29. Note that the day has been adjusted by two.

This method is typically used to subtract complex period instances. Subtracting one field is best achieved using methods like DateTime.minusYears(int) .

If the amount is zero or null, then this is returned. This datetime instance is immutable and unaffected by this method call.
Parameters:
  period - the period to reduce this instant by a copy of this datetime with the period taken away
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




minusDays
public DateTime minusDays(int days)(Code)
Returns a copy of this datetime minus the specified number of days.

The calculation will do its best to only change the day field retaining the same time of day. However, in certain circumstances, typically daylight savings cutover, it may be necessary to alter the time fields.

In spring an hour is typically removed. If subtracting one day results in the time being within the cutover then the time is adjusted to be within summer time. For example, if the cutover is from 01:59 to 03:00 and the result of this method would have been 02:30, then the result will be adjusted to 03:30.

The following three lines are identical in effect:

 DateTime subtracted = dt.minusDays(6);
 DateTime subtracted = dt.minus(Period.days(6));
 DateTime subtracted = dt.withFieldAdded(DurationFieldType.days(), -6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  days - the amount of days to subtract, may be negative the new datetime minus the increased days
since:
   1.1




minusHours
public DateTime minusHours(int hours)(Code)
Returns a copy of this datetime minus the specified number of hours.

The calculation will subtract a duration equivalent to the number of hours expressed in milliseconds.

For example, if a spring daylight savings cutover is from 01:59 to 03:00 then subtracting one hour from 03:30 will result in 01:30. This is a duration of one hour earlier, even though the hour field value changed from 3 to 1.

The following three lines are identical in effect:

 DateTime subtracted = dt.minusHours(6);
 DateTime subtracted = dt.minus(Period.hours(6));
 DateTime subtracted = dt.withFieldAdded(DurationFieldType.hours(), -6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  hours - the amount of hours to subtract, may be negative the new datetime minus the increased hours
since:
   1.1




minusMillis
public DateTime minusMillis(int millis)(Code)
Returns a copy of this datetime minus the specified number of millis.

The calculation will subtract a duration equivalent to the number of milliseconds.

The following three lines are identical in effect:

 DateTime subtracted = dt.minusMillis(6);
 DateTime subtracted = dt.minus(Period.millis(6));
 DateTime subtracted = dt.withFieldAdded(DurationFieldType.millis(), -6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  millis - the amount of millis to subtract, may be negative the new datetime minus the increased millis
since:
   1.1




minusMinutes
public DateTime minusMinutes(int minutes)(Code)
Returns a copy of this datetime minus the specified number of minutes.

The calculation will subtract a duration equivalent to the number of minutes expressed in milliseconds.

The following three lines are identical in effect:

 DateTime subtracted = dt.minusMinutes(6);
 DateTime subtracted = dt.minus(Period.minutes(6));
 DateTime subtracted = dt.withFieldAdded(DurationFieldType.minutes(), -6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  minutes - the amount of minutes to subtract, may be negative the new datetime minus the increased minutes
since:
   1.1




minusMonths
public DateTime minusMonths(int months)(Code)
Returns a copy of this datetime minus the specified number of months.

The calculation will do its best to only change the month field retaining the same day of month. However, in certain circumstances, it may be necessary to alter smaller fields. For example, 2007-05-31 minus one month cannot result in 2007-04-31, so the day of month is adjusted to 2007-04-30.

The following three lines are identical in effect:

 DateTime subtracted = dt.minusMonths(6);
 DateTime subtracted = dt.minus(Period.months(6));
 DateTime subtracted = dt.withFieldAdded(DurationFieldType.months(), -6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  months - the amount of months to subtract, may be negative the new datetime minus the increased months
since:
   1.1




minusSeconds
public DateTime minusSeconds(int seconds)(Code)
Returns a copy of this datetime minus the specified number of seconds.

The calculation will subtract a duration equivalent to the number of seconds expressed in milliseconds.

The following three lines are identical in effect:

 DateTime subtracted = dt.minusSeconds(6);
 DateTime subtracted = dt.minus(Period.seconds(6));
 DateTime subtracted = dt.withFieldAdded(DurationFieldType.seconds(), -6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  seconds - the amount of seconds to subtract, may be negative the new datetime minus the increased seconds
since:
   1.1




minusWeeks
public DateTime minusWeeks(int weeks)(Code)
Returns a copy of this datetime minus the specified number of weeks.

The calculation operates as if it were subtracting the equivalent in days.

The following three lines are identical in effect:

 DateTime subtracted = dt.minusWeeks(6);
 DateTime subtracted = dt.minus(Period.weeks(6));
 DateTime subtracted = dt.withFieldAdded(DurationFieldType.weeks(), -6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  weeks - the amount of weeks to subtract, may be negative the new datetime minus the increased weeks
since:
   1.1




minusYears
public DateTime minusYears(int years)(Code)
Returns a copy of this datetime minus the specified number of years.

The calculation will do its best to only change the year field retaining the same month of year. However, in certain circumstances, it may be necessary to alter smaller fields. For example, 2008-02-29 minus one year cannot result in 2007-02-29, so the day of month is adjusted to 2007-02-28.

The following three lines are identical in effect:

 DateTime subtracted = dt.minusYears(6);
 DateTime subtracted = dt.minus(Period.years(6));
 DateTime subtracted = dt.withFieldAdded(DurationFieldType.years(), -6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  years - the amount of years to subtract, may be negative the new datetime minus the increased years
since:
   1.1




minuteOfDay
public Property minuteOfDay()(Code)
Get the minute of day property which provides access to advanced functionality. the minute of day property



minuteOfHour
public Property minuteOfHour()(Code)
Get the minute of hour field property which provides access to advanced functionality. the minute of hour property



monthOfYear
public Property monthOfYear()(Code)
Get the month of year property which provides access to advanced functionality. the month of year property



plus
public DateTime plus(long duration)(Code)
Returns a copy of this datetime with the specified duration added.

If the amount is zero or null, then this is returned. This datetime instance is immutable and unaffected by this method call.
Parameters:
  duration - the duration, in millis, to add to this one a copy of this datetime with the duration added
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




plus
public DateTime plus(ReadableDuration duration)(Code)
Returns a copy of this datetime with the specified duration added.

If the amount is zero or null, then this is returned. This datetime instance is immutable and unaffected by this method call.
Parameters:
  duration - the duration to add to this one, null means zero a copy of this datetime with the duration added
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




plus
public DateTime plus(ReadablePeriod period)(Code)
Returns a copy of this datetime with the specified period added.

This method will add each element of the period one by one, from largest to smallest, adjusting the datetime to be accurate between each.

Thus, adding a period of one month and one day to 2007-03-31 will work as follows: First add one month and adjust, resulting in 2007-04-30 Then add one day and adjust, resulting in 2007-05-01.

This method is typically used to add complex period instances. Adding one field is best achieved using methods like DateTime.plusYears(int) .

If the amount is zero or null, then this is returned. This datetime instance is immutable and unaffected by this method call.
Parameters:
  period - the duration to add to this one, null means zero a copy of this datetime with the period added
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




plusDays
public DateTime plusDays(int days)(Code)
Returns a copy of this datetime plus the specified number of days.

The calculation will do its best to only change the day field retaining the same time of day. However, in certain circumstances, typically daylight savings cutover, it may be necessary to alter the time fields.

In spring an hour is typically removed. If adding one day results in the time being within the cutover then the time is adjusted to be within summer time. For example, if the cutover is from 01:59 to 03:00 and the result of this method would have been 02:30, then the result will be adjusted to 03:30.

The following three lines are identical in effect:

 DateTime added = dt.plusDays(6);
 DateTime added = dt.plus(Period.days(6));
 DateTime added = dt.withFieldAdded(DurationFieldType.days(), 6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  days - the amount of days to add, may be negative the new datetime plus the increased days
since:
   1.1




plusHours
public DateTime plusHours(int hours)(Code)
Returns a copy of this datetime plus the specified number of hours.

The calculation will add a duration equivalent to the number of hours expressed in milliseconds.

For example, if a spring daylight savings cutover is from 01:59 to 03:00 then adding one hour to 01:30 will result in 03:30. This is a duration of one hour later, even though the hour field value changed from 1 to 3.

The following three lines are identical in effect:

 DateTime added = dt.plusHours(6);
 DateTime added = dt.plus(Period.hours(6));
 DateTime added = dt.withFieldAdded(DurationFieldType.hours(), 6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  hours - the amount of hours to add, may be negative the new datetime plus the increased hours
since:
   1.1




plusMillis
public DateTime plusMillis(int millis)(Code)
Returns a copy of this datetime plus the specified number of millis.

The calculation will add a duration equivalent to the number of milliseconds.

The following three lines are identical in effect:

 DateTime added = dt.plusMillis(6);
 DateTime added = dt.plus(Period.millis(6));
 DateTime added = dt.withFieldAdded(DurationFieldType.millis(), 6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  millis - the amount of millis to add, may be negative the new datetime plus the increased millis
since:
   1.1




plusMinutes
public DateTime plusMinutes(int minutes)(Code)
Returns a copy of this datetime plus the specified number of minutes.

The calculation will add a duration equivalent to the number of minutes expressed in milliseconds.

The following three lines are identical in effect:

 DateTime added = dt.plusMinutes(6);
 DateTime added = dt.plus(Period.minutes(6));
 DateTime added = dt.withFieldAdded(DurationFieldType.minutes(), 6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  minutes - the amount of minutes to add, may be negative the new datetime plus the increased minutes
since:
   1.1




plusMonths
public DateTime plusMonths(int months)(Code)
Returns a copy of this datetime plus the specified number of months.

The calculation will do its best to only change the month field retaining the same day of month. However, in certain circumstances, it may be necessary to alter smaller fields. For example, 2007-03-31 plus one month cannot result in 2007-04-31, so the day of month is adjusted to 2007-04-30.

The following three lines are identical in effect:

 DateTime added = dt.plusMonths(6);
 DateTime added = dt.plus(Period.months(6));
 DateTime added = dt.withFieldAdded(DurationFieldType.months(), 6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  months - the amount of months to add, may be negative the new datetime plus the increased months
since:
   1.1




plusSeconds
public DateTime plusSeconds(int seconds)(Code)
Returns a copy of this datetime plus the specified number of seconds.

The calculation will add a duration equivalent to the number of seconds expressed in milliseconds.

The following three lines are identical in effect:

 DateTime added = dt.plusSeconds(6);
 DateTime added = dt.plus(Period.seconds(6));
 DateTime added = dt.withFieldAdded(DurationFieldType.seconds(), 6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  seconds - the amount of seconds to add, may be negative the new datetime plus the increased seconds
since:
   1.1




plusWeeks
public DateTime plusWeeks(int weeks)(Code)
Returns a copy of this datetime plus the specified number of weeks.

The calculation operates as if it were adding the equivalent in days.

The following three lines are identical in effect:

 DateTime added = dt.plusWeeks(6);
 DateTime added = dt.plus(Period.weeks(6));
 DateTime added = dt.withFieldAdded(DurationFieldType.weeks(), 6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  weeks - the amount of weeks to add, may be negative the new datetime plus the increased weeks
since:
   1.1




plusYears
public DateTime plusYears(int years)(Code)
Returns a copy of this datetime plus the specified number of years.

The calculation will do its best to only change the year field retaining the same month of year. However, in certain circumstances, it may be necessary to alter smaller fields. For example, 2008-02-29 plus one year cannot result in 2009-02-29, so the day of month is adjusted to 2009-02-28.

The following three lines are identical in effect:

 DateTime added = dt.plusYears(6);
 DateTime added = dt.plus(Period.years(6));
 DateTime added = dt.withFieldAdded(DurationFieldType.years(), 6);
 

This datetime instance is immutable and unaffected by this method call.
Parameters:
  years - the amount of years to add, may be negative the new datetime plus the increased years
since:
   1.1




property
public Property property(DateTimeFieldType type)(Code)
Gets the property object for the specified type, which contains many useful methods.
Parameters:
  type - the field type to get the chronology for the property object
throws:
  IllegalArgumentException - if the field is null or unsupported



secondOfDay
public Property secondOfDay()(Code)
Get the second of day property which provides access to advanced functionality. the second of day property



secondOfMinute
public Property secondOfMinute()(Code)
Get the second of minute field property which provides access to advanced functionality. the second of minute property



toDateMidnight
public DateMidnight toDateMidnight()(Code)
Converts this object to a DateMidnight using the same millis and chronology. a DateMidnight using the same millis and chronology



toDateTime
public DateTime toDateTime()(Code)
Get this object as a DateTime by returning this. this



toDateTime
public DateTime toDateTime(DateTimeZone zone)(Code)
Get this object as a DateTime, returning this if possible.
Parameters:
  zone - time zone to apply, or default if null a DateTime using the same millis



toDateTime
public DateTime toDateTime(Chronology chronology)(Code)
Get this object as a DateTime, returning this if possible.
Parameters:
  chronology - chronology to apply, or ISOChronology if null a DateTime using the same millis



toDateTimeISO
public DateTime toDateTimeISO()(Code)
Get this object as a DateTime using ISOChronology in the default zone, returning this if possible. a DateTime using the same millis



toLocalDate
public LocalDate toLocalDate()(Code)
Converts this object to a LocalDate with the same date and chronology. a LocalDate with the same date and chronology
since:
   1.3



toLocalDateTime
public LocalDateTime toLocalDateTime()(Code)
Converts this object to a LocalDateTime with the same datetime and chronology. a LocalDateTime with the same datetime and chronology
since:
   1.3



toLocalTime
public LocalTime toLocalTime()(Code)
Converts this object to a LocalTime with the same time and chronology. a LocalTime with the same time and chronology
since:
   1.3



toTimeOfDay
public TimeOfDay toTimeOfDay()(Code)
Converts this object to a TimeOfDay using the same millis and chronology. a TimeOfDay using the same millis and chronology



toYearMonthDay
public YearMonthDay toYearMonthDay()(Code)
Converts this object to a YearMonthDay using the same millis and chronology. a YearMonthDay using the same millis and chronology



weekOfWeekyear
public Property weekOfWeekyear()(Code)
Get the week of a week based year property which provides access to advanced functionality. the week of a week based year property



weekyear
public Property weekyear()(Code)
Get the year of a week based year property which provides access to advanced functionality. the year of a week based year property



withCenturyOfEra
public DateTime withCenturyOfEra(int centuryOfEra)(Code)
Returns a copy of this datetime with the century of era field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of century of era changed.
Parameters:
  centuryOfEra - the centurey of era to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withChronology
public DateTime withChronology(Chronology newChronology)(Code)
Returns a copy of this datetime with a different chronology.

The returned object will be either be a new instance or this. Only the chronology will change, the millis are kept.
Parameters:
  newChronology - the new chronology, null means ISO default a copy of this datetime with a different chronology




withDate
public DateTime withDate(int year, int monthOfYear, int dayOfMonth)(Code)
Returns a copy of this datetime with the specified date, retaining the time fields.

If the date is already the date passed in, then this is returned.

To set a single field use the properties, for example:

 DateTime set = monthOfYear().setCopy(6);
 

Parameters:
  year - the new year value
Parameters:
  monthOfYear - the new monthOfYear value
Parameters:
  dayOfMonth - the new dayOfMonth value a copy of this datetime with a different date
throws:
  IllegalArgumentException - if any value if invalid



withDayOfMonth
public DateTime withDayOfMonth(int dayOfMonth)(Code)
Returns a copy of this datetime with the day of month field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of day of month changed.
Parameters:
  dayOfMonth - the day of month to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withDayOfWeek
public DateTime withDayOfWeek(int dayOfWeek)(Code)
Returns a copy of this datetime with the day of week field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of day of week changed.
Parameters:
  dayOfWeek - the day of week to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withDayOfYear
public DateTime withDayOfYear(int dayOfYear)(Code)
Returns a copy of this datetime with the day of year field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of day of year changed.
Parameters:
  dayOfYear - the day of year to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withDurationAdded
public DateTime withDurationAdded(long durationToAdd, int scalar)(Code)
Returns a copy of this datetime with the specified duration added.

If the addition is zero, then this is returned.
Parameters:
  durationToAdd - the duration to add to this one
Parameters:
  scalar - the amount of times to add, such as -1 to subtract once a copy of this datetime with the duration added
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




withDurationAdded
public DateTime withDurationAdded(ReadableDuration durationToAdd, int scalar)(Code)
Returns a copy of this datetime with the specified duration added.

If the addition is zero, then this is returned.
Parameters:
  durationToAdd - the duration to add to this one, null means zero
Parameters:
  scalar - the amount of times to add, such as -1 to subtract once a copy of this datetime with the duration added
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




withEra
public DateTime withEra(int era)(Code)
Returns a copy of this datetime with the era field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of era changed.
Parameters:
  era - the era to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withField
public DateTime withField(DateTimeFieldType fieldType, int value)(Code)
Returns a copy of this datetime with the specified field set to a new value.

For example, if the field type is hourOfDay then the hour of day field would be changed in the returned instance. If the field type is null, then this is returned.

These three lines are equivalent:

 DateTime updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6);
 DateTime updated = dt.dayOfMonth().setCopy(6);
 DateTime updated = dt.property(DateTimeFieldType.dayOfMonth()).setCopy(6);
 

Parameters:
  fieldType - the field type to set, not null
Parameters:
  value - the value to set a copy of this datetime with the field set
throws:
  IllegalArgumentException - if the value is null or invalid



withFieldAdded
public DateTime withFieldAdded(DurationFieldType fieldType, int amount)(Code)
Returns a copy of this datetime with the value of the specified field increased.

If the addition is zero or the field is null, then this is returned.

These three lines are equivalent:

 DateTime added = dt.withFieldAdded(DurationFieldType.years(), 6);
 DateTime added = dt.plusYears(6);
 DateTime added = dt.plus(Period.years(6));
 

Parameters:
  fieldType - the field type to add to, not null
Parameters:
  amount - the amount to add a copy of this datetime with the field updated
throws:
  IllegalArgumentException - if the value is null or invalid
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long



withFields
public DateTime withFields(ReadablePartial partial)(Code)
Returns a copy of this datetime with the partial set of fields replacing those from this instance.

For example, if the partial is a TimeOfDay then the time fields would be changed in the returned instance. If the partial is null, then this is returned.
Parameters:
  partial - the partial set of fields to apply to this datetime, null ignored a copy of this datetime with a different set of fields
throws:
  IllegalArgumentException - if any value is invalid




withHourOfDay
public DateTime withHourOfDay(int hour)(Code)
Returns a copy of this datetime with the hour of day field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of hour of day changed.
Parameters:
  hour - the hour of day to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withMillis
public DateTime withMillis(long newMillis)(Code)
Returns a copy of this datetime with different millis.

The returned object will be either be a new instance or this. Only the millis will change, the chronology and time zone are kept.
Parameters:
  newMillis - the new millis, from 1970-01-01T00:00:00Z a copy of this datetime with different millis




withMillisOfDay
public DateTime withMillisOfDay(int millis)(Code)
Returns a copy of this datetime with the millis of day field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of millis of day changed.
Parameters:
  millis - the millis of day to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withMillisOfSecond
public DateTime withMillisOfSecond(int millis)(Code)
Returns a copy of this datetime with the millis of second field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of millis of second changed.
Parameters:
  millis - the millis of second to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withMinuteOfHour
public DateTime withMinuteOfHour(int minute)(Code)
Returns a copy of this datetime with the minute of hour updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of minute of hour changed.
Parameters:
  minute - the minute of hour to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withMonthOfYear
public DateTime withMonthOfYear(int monthOfYear)(Code)
Returns a copy of this datetime with the month of year field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of month of year changed.
Parameters:
  monthOfYear - the month of year to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withPeriodAdded
public DateTime withPeriodAdded(ReadablePeriod period, int scalar)(Code)
Returns a copy of this datetime with the specified period added.

If the addition is zero, then this is returned.

This method is typically used to add multiple copies of complex period instances. Adding one field is best achieved using methods like DateTime.withFieldAdded(DurationFieldType,int) or DateTime.plusYears(int) .
Parameters:
  period - the period to add to this one, null means zero
Parameters:
  scalar - the amount of times to add, such as -1 to subtract once a copy of this datetime with the period added
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




withSecondOfMinute
public DateTime withSecondOfMinute(int second)(Code)
Returns a copy of this datetime with the second of minute field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of second of minute changed.
Parameters:
  second - the second of minute to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withTime
public DateTime withTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)(Code)
Returns a copy of this datetime with the specified time, retaining the date fields.

If the time is already the time passed in, then this is returned.

To set a single field use the properties, for example:

 DateTime set = dt.hourOfDay().setCopy(6);
 

Parameters:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour
Parameters:
  secondOfMinute - the second of the minute
Parameters:
  millisOfSecond - the millisecond of the second a copy of this datetime with a different time
throws:
  IllegalArgumentException - if any value if invalid



withWeekOfWeekyear
public DateTime withWeekOfWeekyear(int weekOfWeekyear)(Code)
Returns a copy of this datetime with the week of weekyear field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of week of weekyear changed.
Parameters:
  weekOfWeekyear - the week of weekyear to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withWeekyear
public DateTime withWeekyear(int weekyear)(Code)
Returns a copy of this datetime with the weekyear field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of weekyear changed.
Parameters:
  weekyear - the weekyear to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withYear
public DateTime withYear(int year)(Code)
Returns a copy of this datetime with the year field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of year changed.
Parameters:
  year - the year to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withYearOfCentury
public DateTime withYearOfCentury(int yearOfCentury)(Code)
Returns a copy of this datetime with the year of century field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of year of century changed.
Parameters:
  yearOfCentury - the year of century to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withYearOfEra
public DateTime withYearOfEra(int yearOfEra)(Code)
Returns a copy of this datetime with the year of era field updated.

DateTime is immutable, so there are no set methods. Instead, this method returns a new instance with the value of year of era changed.
Parameters:
  yearOfEra - the year of era to set a copy of this object with the field set
throws:
  IllegalArgumentException - if the value is invalid
since:
   1.3




withZone
public DateTime withZone(DateTimeZone newZone)(Code)
Returns a copy of this datetime with a different time zone, preserving the millisecond instant.

This method is useful for finding the local time in another timezone. For example, if this instant holds 12:30 in Europe/London, the result from this method with Europe/Paris would be 13:30.

The returned object will be a new instance of the same implementation type. This method changes the time zone, and does not change the millisecond instant, with the effect that the field values usually change. The returned object will be either be a new instance or this.
Parameters:
  newZone - the new time zone a copy of this datetime with a different time zone
See Also:   DateTime.withZoneRetainFields




withZoneRetainFields
public DateTime withZoneRetainFields(DateTimeZone newZone)(Code)
Returns a copy of this datetime with a different time zone, preserving the field values.

This method is useful for finding the millisecond time in another timezone. For example, if this instant holds 12:30 in Europe/London (ie. 12:30Z), the result from this method with Europe/Paris would be 12:30 (ie. 11:30Z).

The returned object will be a new instance of the same implementation type. This method changes the time zone and the millisecond instant to keep the field values the same. The returned object will be either be a new instance or this.
Parameters:
  newZone - the new time zone, null means default a copy of this datetime with a different time zone
See Also:   DateTime.withZone




year
public Property year()(Code)
Get the year property which provides access to advanced functionality. the year property



yearOfCentury
public Property yearOfCentury()(Code)
Get the year of century property which provides access to advanced functionality. the year of era property



yearOfEra
public Property yearOfEra()(Code)
Get the year of era property which provides access to advanced functionality. the year of era property



Methods inherited from org.joda.time.base.BaseDateTime
protected Chronology checkChronology(Chronology chronology)(Code)(Java Doc)
protected long checkInstant(long instant, Chronology chronology)(Code)(Java Doc)
public Chronology getChronology()(Code)(Java Doc)
public long getMillis()(Code)(Java Doc)
protected void setChronology(Chronology chronology)(Code)(Java Doc)
protected void setMillis(long instant)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.