Java Doc for YearMonthDay.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.BasePartial
   org.joda.time.YearMonthDay

YearMonthDay
final public class YearMonthDay extends BasePartial implements ReadablePartial,Serializable(Code)
YearMonthDay is an immutable partial supporting the year, monthOfYear and dayOfMonth fields.

NOTE: This class only supports the three fields listed above. Thus, you cannot query the dayOfWeek or centuryOfEra fields for example. The new LocalDate class removes this restriction.

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()
  • set - monthOfYear().setCopy()

YearMonthDay 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
since:
   1.0


Inner Class :public static class Property extends AbstractPartialFieldProperty implements Serializable

Field Summary
final public static  intDAY_OF_MONTH
    
final public static  intMONTH_OF_YEAR
    
final public static  intYEAR
    

Constructor Summary
public  YearMonthDay()
     Constructs a YearMonthDay with the current date, using ISOChronology in the default zone to extract the fields.

The constructor uses the default time zone, resulting in the local time being initialised.

public  YearMonthDay(DateTimeZone zone)
     Constructs a YearMonthDay with the current date, using ISOChronology in the specified zone to extract the fields.
public  YearMonthDay(Chronology chronology)
     Constructs a YearMonthDay with the current date, using the specified chronology and zone to extract the fields.
public  YearMonthDay(long instant)
     Constructs a YearMonthDay extracting the partial fields from the specified milliseconds using the ISOChronology in the default zone.

The constructor uses the default time zone, resulting in the local time being initialised.

public  YearMonthDay(long instant, Chronology chronology)
     Constructs a YearMonthDay extracting the partial fields from the specified milliseconds using the chronology provided.
public  YearMonthDay(Object instant)
     Constructs a YearMonthDay from an Object that represents a time.

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.dateOptionalTimeParser .

The chronology used will be derived from the object, defaulting to ISO.

NOTE: Prior to v1.3 the string format was described by ISODateTimeFormat.dateTimeParser .

public  YearMonthDay(Object instant, Chronology chronology)
     Constructs a YearMonthDay from an Object that represents a time, using the specified chronology.

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.dateOptionalTimeParser .

The constructor uses the time zone of the chronology specified. Once the constructor is complete, all further calculations are performed without reference to a timezone (by switching to UTC). The specified chronology overrides that of the object.

NOTE: Prior to v1.3 the string format was described by ISODateTimeFormat.dateTimeParser .

public  YearMonthDay(int year, int monthOfYear, int dayOfMonth)
     Constructs a YearMonthDay with specified time field values using ISOChronology in the default zone.
public  YearMonthDay(int year, int monthOfYear, int dayOfMonth, Chronology chronology)
     Constructs a YearMonthDay with specified time field values.
 YearMonthDay(YearMonthDay partial, int[] values)
     Constructs a YearMonthDay with chronology from this instance and new values.
 YearMonthDay(YearMonthDay partial, Chronology chrono)
     Constructs a YearMonthDay with values from this instance and a new chronology.

Method Summary
public  PropertydayOfMonth()
     Get the day of month field property which provides access to advanced functionality.
public static  YearMonthDayfromCalendarFields(Calendar calendar)
     Constructs a YearMonthDay from a java.util.Calendar using exactly the same field values avoiding any time zone effects.

Each field is queried from the Calendar and assigned to the YearMonthDay. This is useful if you have been using the Calendar as a local date, ignoing the zone.

This factory method ignores the type of the calendar and always creates a YearMonthDay with ISO chronology.

public static  YearMonthDayfromDateFields(Date date)
     Constructs a YearMonthDay from a java.util.Date using exactly the same field values avoiding any time zone effects.
public  intgetDayOfMonth()
     Get the day of month field value.
protected  DateTimeFieldgetField(int index, Chronology chrono)
     Gets the field for a specific index in the chronology specified.
public  DateTimeFieldTypegetFieldType(int index)
     Gets the field type at the specified index.
public  DateTimeFieldType[]getFieldTypes()
     Gets an array of the field type of each of the fields that this partial supports.
public  intgetMonthOfYear()
     Get the month of year field value.
public  intgetYear()
     Get the year field value.
public  YearMonthDayminus(ReadablePeriod period)
     Returns a copy of this date with the specified period taken away.
public  YearMonthDayminusDays(int days)
     Returns a copy of this date minus the specified number of days.
public  YearMonthDayminusMonths(int months)
     Returns a copy of this date minus the specified number of months.
public  YearMonthDayminusYears(int years)
     Returns a copy of this date minus the specified number of years.
public  PropertymonthOfYear()
     Get the month of year field property which provides access to advanced functionality.
public  YearMonthDayplus(ReadablePeriod period)
     Returns a copy of this date with the specified period added.
public  YearMonthDayplusDays(int days)
     Returns a copy of this date plus the specified number of days.
public  YearMonthDayplusMonths(int months)
     Returns a copy of this date plus the specified number of months.
public  YearMonthDayplusYears(int years)
     Returns a copy of this date plus the specified number of years.
public  Propertyproperty(DateTimeFieldType type)
     Gets the property object for the specified type, which contains many useful methods.
public  intsize()
     Gets the number of fields in this partial.
public  DateMidnighttoDateMidnight()
     Converts this object to a DateMidnight in the default time zone.
public  DateMidnighttoDateMidnight(DateTimeZone zone)
     Converts this object to a DateMidnight.
public  DateTimetoDateTime(TimeOfDay time)
     Converts this object to a DateTime using a TimeOfDay to fill in the missing fields and using the default time zone.
public  DateTimetoDateTime(TimeOfDay time, DateTimeZone zone)
     Converts this object to a DateTime using a TimeOfDay to fill in the missing fields.
public  DateTimetoDateTimeAtCurrentTime()
     Converts this partial to a full datetime using the default time zone setting the date fields from this instance and the time fields from the current time.
public  DateTimetoDateTimeAtCurrentTime(DateTimeZone zone)
     Converts this partial to a full datetime using the specified time zone setting the date fields from this instance and the time fields from the current time.
public  DateTimetoDateTimeAtMidnight()
     Converts this YearMonthDay to a full datetime at midnight using the default time zone.
public  DateTimetoDateTimeAtMidnight(DateTimeZone zone)
     Converts this YearMonthDay to a full datetime at midnight using the specified time zone.
public  IntervaltoInterval()
     Converts this object to an Interval representing the whole day in the default time zone.
public  IntervaltoInterval(DateTimeZone zone)
     Converts this object to an Interval representing the whole day.
public  LocalDatetoLocalDate()
     Converts this object to a LocalDate with the same date and chronology.
public  StringtoString()
     Output the date in the ISO8601 format YYYY-MM-DD.
public  YearMonthDaywithChronologyRetainFields(Chronology newChronology)
     Returns a copy of this date with the specified chronology.
public  YearMonthDaywithDayOfMonth(int dayOfMonth)
     Returns a copy of this date with the day of month field updated.
public  YearMonthDaywithField(DateTimeFieldType fieldType, int value)
     Returns a copy of this date with the specified field set to a new value.
public  YearMonthDaywithFieldAdded(DurationFieldType fieldType, int amount)
     Returns a copy of this date with the value of the specified field increased.
public  YearMonthDaywithMonthOfYear(int monthOfYear)
     Returns a copy of this date with the month of year field updated.
public  YearMonthDaywithPeriodAdded(ReadablePeriod period, int scalar)
     Returns a copy of this date with the specified period added.

If the addition is zero, then this is returned. Fields in the period that aren't present in the partial are ignored.

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

public  YearMonthDaywithYear(int year)
     Returns a copy of this date with the year field updated.
public  Propertyyear()
     Get the year field property which provides access to advanced functionality.

Field Detail
DAY_OF_MONTH
final public static int DAY_OF_MONTH(Code)
The index of the dayOfMonth field in the field array



MONTH_OF_YEAR
final public static int MONTH_OF_YEAR(Code)
The index of the monthOfYear field in the field array



YEAR
final public static int YEAR(Code)
The index of the year field in the field array




Constructor Detail
YearMonthDay
public YearMonthDay()(Code)
Constructs a YearMonthDay with the current date, using ISOChronology in the default zone to extract the fields.

The constructor uses the default time zone, resulting in the local time being initialised. Once the constructor is complete, all further calculations are performed without reference to a timezone (by switching to UTC).




YearMonthDay
public YearMonthDay(DateTimeZone zone)(Code)
Constructs a YearMonthDay with the current date, using ISOChronology in the specified zone to extract the fields.

The constructor uses the specified time zone to obtain the current date. Once the constructor is complete, all further calculations are performed without reference to a timezone (by switching to UTC).
Parameters:
  zone - the zone to use, null means default zone
since:
   1.1




YearMonthDay
public YearMonthDay(Chronology chronology)(Code)
Constructs a YearMonthDay with the current date, using the specified chronology and zone to extract the fields.

The constructor uses the time zone of the chronology specified. Once the constructor is complete, all further calculations are performed without reference to a timezone (by switching to UTC).
Parameters:
  chronology - the chronology, null means ISOChronology in the default zone




YearMonthDay
public YearMonthDay(long instant)(Code)
Constructs a YearMonthDay extracting the partial fields from the specified milliseconds using the ISOChronology in the default zone.

The constructor uses the default time zone, resulting in the local time being initialised. Once the constructor is complete, all further calculations are performed without reference to a timezone (by switching to UTC).
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z




YearMonthDay
public YearMonthDay(long instant, Chronology chronology)(Code)
Constructs a YearMonthDay extracting the partial fields from the specified milliseconds using the chronology provided.

The constructor uses the time zone of the chronology specified. Once the constructor is complete, all further calculations are performed without reference to a timezone (by switching to UTC).
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z
Parameters:
  chronology - the chronology, null means ISOChronology in the default zone




YearMonthDay
public YearMonthDay(Object instant)(Code)
Constructs a YearMonthDay from an Object that represents a time.

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.dateOptionalTimeParser .

The chronology used will be derived from the object, defaulting to ISO.

NOTE: Prior to v1.3 the string format was described by ISODateTimeFormat.dateTimeParser . Time ony strings are now rejected.
Parameters:
  instant - the datetime object, null means now
throws:
  IllegalArgumentException - if the instant is invalid




YearMonthDay
public YearMonthDay(Object instant, Chronology chronology)(Code)
Constructs a YearMonthDay from an Object that represents a time, using the specified chronology.

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.dateOptionalTimeParser .

The constructor uses the time zone of the chronology specified. Once the constructor is complete, all further calculations are performed without reference to a timezone (by switching to UTC). The specified chronology overrides that of the object.

NOTE: Prior to v1.3 the string format was described by ISODateTimeFormat.dateTimeParser . Time only strings are now rejected.
Parameters:
  instant - the datetime object, null means now
Parameters:
  chronology - the chronology, null means ISO default
throws:
  IllegalArgumentException - if the instant is invalid




YearMonthDay
public YearMonthDay(int year, int monthOfYear, int dayOfMonth)(Code)
Constructs a YearMonthDay with specified time field values using ISOChronology in the default zone.

The constructor uses the no time zone initialising the fields as provided. Once the constructor is complete, all further calculations are performed without reference to a timezone (by switching to UTC).
Parameters:
  year - the year
Parameters:
  monthOfYear - the month of the year
Parameters:
  dayOfMonth - the day of the month




YearMonthDay
public YearMonthDay(int year, int monthOfYear, int dayOfMonth, Chronology chronology)(Code)
Constructs a YearMonthDay with specified time field values.

The constructor uses the time zone of the chronology specified. Once the constructor is complete, all further calculations are performed without reference to a timezone (by switching to UTC).
Parameters:
  year - the year
Parameters:
  monthOfYear - the month of the year
Parameters:
  dayOfMonth - the day of the month
Parameters:
  chronology - the chronology, null means ISOChronology in the default zone




YearMonthDay
YearMonthDay(YearMonthDay partial, int[] values)(Code)
Constructs a YearMonthDay with chronology from this instance and new values.
Parameters:
  partial - the partial to base this new instance on
Parameters:
  values - the new set of values



YearMonthDay
YearMonthDay(YearMonthDay partial, Chronology chrono)(Code)
Constructs a YearMonthDay with values from this instance and a new chronology.
Parameters:
  partial - the partial to base this new instance on
Parameters:
  chrono - the new chronology




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



fromCalendarFields
public static YearMonthDay fromCalendarFields(Calendar calendar)(Code)
Constructs a YearMonthDay from a java.util.Calendar using exactly the same field values avoiding any time zone effects.

Each field is queried from the Calendar and assigned to the YearMonthDay. This is useful if you have been using the Calendar as a local date, ignoing the zone.

This factory method ignores the type of the calendar and always creates a YearMonthDay with ISO chronology. It is expected that you will only pass in instances of GregorianCalendar however this is not validated.
Parameters:
  calendar - the Calendar to extract fields from the created YearMonthDay
throws:
  IllegalArgumentException - if the calendar is null
throws:
  IllegalArgumentException - if the date is invalid for the ISO chronology
since:
   1.2




fromDateFields
public static YearMonthDay fromDateFields(Date date)(Code)
Constructs a YearMonthDay from a java.util.Date using exactly the same field values avoiding any time zone effects.

Each field is queried from the Date and assigned to the YearMonthDay. This is useful if you have been using the Date as a local date, ignoing the zone.

This factory method always creates a YearMonthDay with ISO chronology.
Parameters:
  date - the Date to extract fields from the created YearMonthDay
throws:
  IllegalArgumentException - if the calendar is null
throws:
  IllegalArgumentException - if the date is invalid for the ISO chronology
since:
   1.2




getDayOfMonth
public int getDayOfMonth()(Code)
Get the day of month field value. the day of month



getField
protected DateTimeField getField(int index, Chronology chrono)(Code)
Gets the field for a specific index in the chronology specified.

This method must not use any instance variables.
Parameters:
  index - the index to retrieve
Parameters:
  chrono - the chronology to use the field




getFieldType
public DateTimeFieldType getFieldType(int index)(Code)
Gets the field type at the specified index.
Parameters:
  index - the index to retrieve the field at the specified index
throws:
  IndexOutOfBoundsException - if the index is invalid



getFieldTypes
public DateTimeFieldType[] getFieldTypes()(Code)
Gets an array of the field type of each of the fields that this partial supports.

The fields are returned largest to smallest, Year, Month, Day the array of field types (cloned), largest to smallest




getMonthOfYear
public int getMonthOfYear()(Code)
Get the month of year field value. the month of year



getYear
public int getYear()(Code)
Get the year field value. the year



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

If the amount is zero or null, then this is returned.

This method is typically used to subtract complex period instances. Subtracting one field is best achieved using methods like YearMonthDay.minusYears(int) .
Parameters:
  period - the period to reduce this instant by a copy of this instance with the period taken away
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




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

This datetime instance is immutable and unaffected by this method call.

The following three lines are identical in effect:

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

Parameters:
  days - the amount of days to subtract, may be negative the new datetime minus the increased days
since:
   1.1



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

This datetime instance is immutable and unaffected by this method call.

The following three lines are identical in effect:

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

Parameters:
  months - the amount of months to subtract, may be negative the new datetime minus the increased months
since:
   1.1



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

This datetime instance is immutable and unaffected by this method call.

The following three lines are identical in effect:

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

Parameters:
  years - the amount of years to subtract, may be negative the new datetime minus the increased years
since:
   1.1



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



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

If the amount is zero or null, then this is returned.

This method is typically used to add complex period instances. Adding one field is best achieved using methods like YearMonthDay.plusYears(int) .
Parameters:
  period - the duration to add to this one, null means zero a copy of this instance with the period added
throws:
  ArithmeticException - if the new datetime exceeds the capacity of a long




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

This date instance is immutable and unaffected by this method call.

The following three lines are identical in effect:

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

Parameters:
  days - the amount of days to add, may be negative the new date plus the increased days
since:
   1.1



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

This date instance is immutable and unaffected by this method call.

The following three lines are identical in effect:

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

Parameters:
  months - the amount of months to add, may be negative the new date plus the increased months
since:
   1.1



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

This date instance is immutable and unaffected by this method call.

The following three lines are identical in effect:

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

Parameters:
  years - the amount of years to add, may be negative the new date 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 property for the property object
throws:
  IllegalArgumentException - if the field is null or unsupported



size
public int size()(Code)
Gets the number of fields in this partial. the field count



toDateMidnight
public DateMidnight toDateMidnight()(Code)
Converts this object to a DateMidnight in the default time zone. the DateMidnight instance in the default zone



toDateMidnight
public DateMidnight toDateMidnight(DateTimeZone zone)(Code)
Converts this object to a DateMidnight.
Parameters:
  zone - the zone to get the DateMidnight in, null means default the DateMidnight instance



toDateTime
public DateTime toDateTime(TimeOfDay time)(Code)
Converts this object to a DateTime using a TimeOfDay to fill in the missing fields and using the default time zone. This instance is immutable and unaffected by this method call.

The resulting chronology is determined by the chronology of this YearMonthDay plus the time zone. The chronology of the time is ignored - only the field values are used.
Parameters:
  time - the time of day to use, null means current time the DateTime instance




toDateTime
public DateTime toDateTime(TimeOfDay time, DateTimeZone zone)(Code)
Converts this object to a DateTime using a TimeOfDay to fill in the missing fields. This instance is immutable and unaffected by this method call.

The resulting chronology is determined by the chronology of this YearMonthDay plus the time zone. The chronology of the time is ignored - only the field values are used.
Parameters:
  time - the time of day to use, null means current time
Parameters:
  zone - the zone to get the DateTime in, null means default the DateTime instance




toDateTimeAtCurrentTime
public DateTime toDateTimeAtCurrentTime()(Code)
Converts this partial to a full datetime using the default time zone setting the date fields from this instance and the time fields from the current time. this date as a datetime with the time as the current time



toDateTimeAtCurrentTime
public DateTime toDateTimeAtCurrentTime(DateTimeZone zone)(Code)
Converts this partial to a full datetime using the specified time zone setting the date fields from this instance and the time fields from the current time.

This method uses the chronology from this instance plus the time zone specified.
Parameters:
  zone - the zone to use, null means default this date as a datetime with the time as the current time




toDateTimeAtMidnight
public DateTime toDateTimeAtMidnight()(Code)
Converts this YearMonthDay to a full datetime at midnight using the default time zone. this date as a datetime at midnight



toDateTimeAtMidnight
public DateTime toDateTimeAtMidnight(DateTimeZone zone)(Code)
Converts this YearMonthDay to a full datetime at midnight using the specified time zone.

This method uses the chronology from this instance plus the time zone specified.
Parameters:
  zone - the zone to use, null means default this date as a datetime at midnight




toInterval
public Interval toInterval()(Code)
Converts this object to an Interval representing the whole day in the default time zone. a interval over the day



toInterval
public Interval toInterval(DateTimeZone zone)(Code)
Converts this object to an Interval representing the whole day.
Parameters:
  zone - the zone to get the Interval in, null means default a interval over the day



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



toString
public String toString()(Code)
Output the date in the ISO8601 format YYYY-MM-DD. ISO8601 formatted string



withChronologyRetainFields
public YearMonthDay withChronologyRetainFields(Chronology newChronology)(Code)
Returns a copy of this date with the specified chronology. This instance is immutable and unaffected by this method call.

This method retains the values of the fields, thus the result will typically refer to a different instant.

The time zone of the specified chronology is ignored, as YearMonthDay operates without a time zone.
Parameters:
  newChronology - the new chronology, null means ISO a copy of this datetime with a different chronology
throws:
  IllegalArgumentException - if the values are invalid for the new chronology




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

YearMonthDay 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




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

For example, if the field type is dayOfMonth then the day would be changed in the returned instance.

These three lines are equivalent:

 YearMonthDay updated = ymd.withField(DateTimeFieldType.dayOfMonth(), 6);
 YearMonthDay updated = ymd.dayOfMonth().setCopy(6);
 YearMonthDay updated = ymd.property(DateTimeFieldType.dayOfMonth()).setCopy(6);
 

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



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

If the addition is zero, then this is returned.

These three lines are equivalent:

 YearMonthDay added = ymd.withFieldAdded(DurationFieldType.days(), 6);
 YearMonthDay added = ymd.plusDays(6);
 YearMonthDay added = ymd.dayOfMonth().addToCopy(6);
 

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



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

YearMonthDay 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 YearMonthDay withPeriodAdded(ReadablePeriod period, int scalar)(Code)
Returns a copy of this date with the specified period added.

If the addition is zero, then this is returned. Fields in the period that aren't present in the partial are ignored.

This method is typically used to add multiple copies of complex period instances. Adding one field is best achieved using methods like YearMonthDay.withFieldAdded(DurationFieldType,int) or YearMonthDay.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 instance with the period added
throws:
  ArithmeticException - if the new datetime exceeds the capacity




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

YearMonthDay 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




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



Methods inherited from org.joda.time.base.BasePartial
public Chronology getChronology()(Code)(Java Doc)
public int getValue(int index)(Code)(Java Doc)
public int[] getValues()(Code)(Java Doc)
protected void setValue(int index, int value)(Code)(Java Doc)
protected void setValues(int[] values)(Code)(Java Doc)
public String toString(String pattern)(Code)(Java Doc)
public String toString(String pattern, Locale locale) throws IllegalArgumentException(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.