Java Doc for DateMidnight.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.DateMidnight

DateMidnight
final public class DateMidnight extends BaseDateTime implements ReadableDateTime,Serializable(Code)
DateMidnight defines a date where the time component is fixed at midnight. The class uses a time zone, thus midnight is local unless a UTC time zone is used.

It is important to emphasise that this class represents the time of midnight on any given day. Note that midnight is defined as 00:00, which is at the very start of a day.

This class does not represent a day, but the millisecond instant at midnight. If you need a class that represents the whole day, then an Interval or a LocalDate may be more suitable.

This class uses a Chronology internally. The Chronology determines how the millisecond instant value is converted into the date time fields. The default Chronology is ISOChronology which is the agreed international standard and compatable with the modern Gregorian calendar.

Each individual field can be queried in two ways:

  • getDayOfMonth()
  • dayOfMonth().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

DateMidnight 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 :final public static class Property extends AbstractReadableInstantFieldProperty


Constructor Summary
public  DateMidnight()
     Constructs an instance set to the current system millisecond time using ISOChronology in the default time zone.
public  DateMidnight(DateTimeZone zone)
     Constructs an instance set to the current system millisecond time using ISOChronology in the specified time zone.
public  DateMidnight(Chronology chronology)
     Constructs an instance set to the current system millisecond time using the specified chronology.
public  DateMidnight(long instant)
     Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using ISOChronology in the default time zone.
public  DateMidnight(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  DateMidnight(long instant, Chronology chronology)
     Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using the specified chronology.
public  DateMidnight(Object instant)
     Constructs an instance from an Object that represents a datetime. The constructed object will have a local time of midnight.

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

public  DateMidnight(Object instant, DateTimeZone zone)
     Constructs an instance from an Object that represents a datetime, forcing the time zone to that specified.
public  DateMidnight(Object instant, Chronology chronology)
     Constructs an instance from an Object that represents a datetime, using the specified chronology.
public  DateMidnight(int year, int monthOfYear, int dayOfMonth)
     Constructs an instance from datetime field values using ISOChronology in the default time zone.
public  DateMidnight(int year, int monthOfYear, int dayOfMonth, DateTimeZone zone)
     Constructs an instance from datetime field values using ISOChronology in the specified time zone.
public  DateMidnight(int year, int monthOfYear, int dayOfMonth, 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.
protected  longcheckInstant(long instant, Chronology chronology)
     Rounds the specified instant to midnight.
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  DateMidnightminus(long duration)
     Returns a copy of this date with the specified duration taken away.
public  DateMidnightminus(ReadableDuration duration)
     Returns a copy of this date with the specified duration taken away.
public  DateMidnightminus(ReadablePeriod period)
     Returns a copy of this date with the specified period taken away.
public  DateMidnightminusDays(int days)
     Returns a copy of this date minus the specified number of days.
public  DateMidnightminusMonths(int months)
     Returns a copy of this date minus the specified number of months.
public  DateMidnightminusWeeks(int weeks)
     Returns a copy of this date minus the specified number of weeks.
public  DateMidnightminusYears(int years)
     Returns a copy of this date minus the specified number of years.
public  PropertymonthOfYear()
     Get the month of year property which provides access to advanced functionality.
public  DateMidnightplus(long duration)
     Returns a copy of this date with the specified duration added.
public  DateMidnightplus(ReadableDuration duration)
     Returns a copy of this date with the specified duration added.
public  DateMidnightplus(ReadablePeriod period)
     Returns a copy of this date with the specified period added.
public  DateMidnightplusDays(int days)
     Returns a copy of this date plus the specified number of days.
public  DateMidnightplusMonths(int months)
     Returns a copy of this date plus the specified number of months.
public  DateMidnightplusWeeks(int weeks)
     Returns a copy of this date plus the specified number of weeks.
public  DateMidnightplusYears(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  IntervaltoInterval()
     Converts this object to an Interval encompassing the whole of this day.
public  LocalDatetoLocalDate()
     Converts this object to a LocalDate with the same date and chronology.
public  YearMonthDaytoYearMonthDay()
     Converts this object to a YearMonthDay using the same date 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  DateMidnightwithCenturyOfEra(int centuryOfEra)
     Returns a copy of this date with the century of era field updated.
public  DateMidnightwithChronology(Chronology newChronology)
     Returns a copy of this date with a different chronology, potentially changing the day in unexpected ways.

This method creates a new DateMidnight using the midnight millisecond value and the new chronology.

public  DateMidnightwithDayOfMonth(int dayOfMonth)
     Returns a copy of this date with the day of month field updated.
public  DateMidnightwithDayOfWeek(int dayOfWeek)
     Returns a copy of this date with the day of week field updated.
public  DateMidnightwithDayOfYear(int dayOfYear)
     Returns a copy of this date with the day of year field updated.
public  DateMidnightwithDurationAdded(long durationToAdd, int scalar)
     Returns a copy of this date with the specified duration added.
public  DateMidnightwithDurationAdded(ReadableDuration durationToAdd, int scalar)
     Returns a copy of this date with the specified duration added.
public  DateMidnightwithEra(int era)
     Returns a copy of this date with the era field updated.
public  DateMidnightwithField(DateTimeFieldType fieldType, int value)
     Returns a copy of this date with the specified field set to a new value.
public  DateMidnightwithFieldAdded(DurationFieldType fieldType, int amount)
     Returns a copy of this date with the value of the specified field increased.
public  DateMidnightwithFields(ReadablePartial partial)
     Returns a copy of this date with the partial set of fields replacing those from this instance.
public  DateMidnightwithMillis(long newMillis)
     Returns a copy of this date with a different millisecond instant.
public  DateMidnightwithMonthOfYear(int monthOfYear)
     Returns a copy of this date with the month of year field updated.
public  DateMidnightwithPeriodAdded(ReadablePeriod period, int scalar)
     Returns a copy of this date 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  DateMidnightwithWeekOfWeekyear(int weekOfWeekyear)
     Returns a copy of this date with the week of weekyear field updated.
public  DateMidnightwithWeekyear(int weekyear)
     Returns a copy of this date with the weekyear field updated.
public  DateMidnightwithYear(int year)
     Returns a copy of this date with the year field updated.
public  DateMidnightwithYearOfCentury(int yearOfCentury)
     Returns a copy of this date with the year of century field updated.
public  DateMidnightwithYearOfEra(int yearOfEra)
     Returns a copy of this date with the year of era field updated.
public  DateMidnightwithZoneRetainFields(DateTimeZone newZone)
     Returns a copy of this date with a different time zone, preserving the day The returned object will have a local time of midnight in the new zone on the same day as the original instant.
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
DateMidnight
public DateMidnight()(Code)
Constructs an instance set to the current system millisecond time using ISOChronology in the default time zone. The constructed object will have a local time of midnight.



DateMidnight
public DateMidnight(DateTimeZone zone)(Code)
Constructs an instance set to the current system millisecond time using ISOChronology in the specified time zone. The constructed object will have a local time of midnight.

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




DateMidnight
public DateMidnight(Chronology chronology)(Code)
Constructs an instance set to the current system millisecond time using the specified chronology. The constructed object will have a local time of midnight.

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




DateMidnight
public DateMidnight(long instant)(Code)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using ISOChronology in the default time zone. The constructed object will have a local time of midnight.
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z



DateMidnight
public DateMidnight(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. The constructed object will have a local time of midnight.

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




DateMidnight
public DateMidnight(long instant, Chronology chronology)(Code)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using the specified chronology. The constructed object will have a local time of midnight.

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




DateMidnight
public DateMidnight(Object instant)(Code)
Constructs an instance from an Object that represents a datetime. The constructed object will have a local time of midnight.

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




DateMidnight
public DateMidnight(Object instant, DateTimeZone zone)(Code)
Constructs an instance from an Object that represents a datetime, forcing the time zone to that specified. The constructed object will have a local time of midnight.

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




DateMidnight
public DateMidnight(Object instant, Chronology chronology)(Code)
Constructs an instance from an Object that represents a datetime, using the specified chronology. The constructed object will have a local time of midnight.

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 ISOChronology in default zone
throws:
  IllegalArgumentException - if the instant is invalid




DateMidnight
public DateMidnight(int year, int monthOfYear, int dayOfMonth)(Code)
Constructs an instance from datetime field values using ISOChronology in the default time zone. The constructed object will have a local time of midnight.
Parameters:
  year - the year
Parameters:
  monthOfYear - the month of the year
Parameters:
  dayOfMonth - the day of the month



DateMidnight
public DateMidnight(int year, int monthOfYear, int dayOfMonth, DateTimeZone zone)(Code)
Constructs an instance from datetime field values using ISOChronology in the specified time zone. The constructed object will have a local time of midnight.

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:
  zone - the time zone, null means default time zone




DateMidnight
public DateMidnight(int year, int monthOfYear, int dayOfMonth, Chronology chronology)(Code)
Constructs an instance from datetime field values using the specified chronology. The constructed object will have a local time of midnight.

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:
  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



checkInstant
protected long checkInstant(long instant, Chronology chronology)(Code)
Rounds the specified instant to midnight.
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z to round
Parameters:
  chronology - the chronology to use, not null the updated instant, rounded to midnight



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



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

If the amount is zero or null, then this is returned.
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 DateMidnight minus(ReadableDuration duration)(Code)
Returns a copy of this date with the specified duration taken away.

If the amount is zero or null, then this is returned.
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 DateMidnight 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 DateMidnight.minusYears(int) .
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 DateMidnight 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:

 DateMidnight subtracted = dt.minusDays(6);
 DateMidnight subtracted = dt.minus(Period.days(6));
 DateMidnight 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 DateMidnight 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:

 DateMidnight subtracted = dt.minusMonths(6);
 DateMidnight subtracted = dt.minus(Period.months(6));
 DateMidnight 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



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

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

The following three lines are identical in effect:

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

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



minusYears
public DateMidnight 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:

 DateTime subtracted = dt.minusYears(6);
 DateTime subtracted = dt.minus(Period.years(6));
 DateTime 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 property which provides access to advanced functionality. the month of year property



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

If the amount is zero, then this is returned.
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 DateMidnight plus(ReadableDuration duration)(Code)
Returns a copy of this date with the specified duration added.

If the amount is zero or null, then this is returned.
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 DateMidnight 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 DateMidnight.plusYears(int) .
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 DateMidnight plusDays(int days)(Code)
Returns a copy of this date plus the specified number of days.

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



toInterval
public Interval toInterval()(Code)
Converts this object to an Interval encompassing the whole of this day.

The interval starts at midnight 00:00 and ends at 00:00 the following day, (which is not included in the interval, as intervals are half-open). an 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



toYearMonthDay
public YearMonthDay toYearMonthDay()(Code)
Converts this object to a YearMonthDay using the same date 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 DateMidnight withCenturyOfEra(int centuryOfEra)(Code)
Returns a copy of this date with the century of era field updated.

DateMidnight 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 DateMidnight withChronology(Chronology newChronology)(Code)
Returns a copy of this date with a different chronology, potentially changing the day in unexpected ways.

This method creates a new DateMidnight using the midnight millisecond value and the new chronology. If the same or similar chronology is specified, but with a different time zone, the day may change. This occurs because the new DateMidnight rounds down the millisecond value to get to midnight, and the time zone change may result in a rounding down to a different day.

For example, changing time zone from London (+00:00) to Paris (+01:00) will retain the same day, but changing from Paris to London will change the day. (When its midnight in London its the same day in Paris, but when its midnight in Paris its still the previous day in London)

To avoid these unusual effects, use DateMidnight.withZoneRetainFields(DateTimeZone) to change time zones.
Parameters:
  newChronology - the new chronology a copy of this instant with a different chronology




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

DateMidnight 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 DateMidnight withDayOfWeek(int dayOfWeek)(Code)
Returns a copy of this date with the day of week field updated.

DateMidnight 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 DateMidnight withDayOfYear(int dayOfYear)(Code)
Returns a copy of this date with the day of year field updated.

DateMidnight 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 DateMidnight withDurationAdded(long durationToAdd, int scalar)(Code)
Returns a copy of this date 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 DateMidnight withDurationAdded(ReadableDuration durationToAdd, int scalar)(Code)
Returns a copy of this date 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 DateMidnight withEra(int era)(Code)
Returns a copy of this date with the era field updated.

DateMidnight 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 DateMidnight 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 of month 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 DateMidnight 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 or the field is null, then this is returned.

These three lines are equivalent:

 DateMidnight added = dt.withFieldAdded(DateTimeFieldType.year(), 6);
 DateMidnight added = dt.plusYears(6);
 DateMidnight added = dt.year().addToCopy(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 DateMidnight withFields(ReadablePartial partial)(Code)
Returns a copy of this date with the partial set of fields replacing those from this instance.

For example, if the partial is a LocalDate then the date 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




withMillis
public DateMidnight withMillis(long newMillis)(Code)
Returns a copy of this date with a different millisecond instant. The returned object will have a local time of midnight.

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




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

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

This method is typically used to add multiple copies of complex period instances. Adding one field is best achieved using methods like DateMidnight.withFieldAdded(DurationFieldType,int) or DateMidnight.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




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

DateMidnight 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 DateMidnight withWeekyear(int weekyear)(Code)
Returns a copy of this date with the weekyear field updated.

DateMidnight 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 DateMidnight withYear(int year)(Code)
Returns a copy of this date with the year field updated.

DateMidnight 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 DateMidnight withYearOfCentury(int yearOfCentury)(Code)
Returns a copy of this date with the year of century field updated.

DateMidnight 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 DateMidnight withYearOfEra(int yearOfEra)(Code)
Returns a copy of this date with the year of era field updated.

DateMidnight 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




withZoneRetainFields
public DateMidnight withZoneRetainFields(DateTimeZone newZone)(Code)
Returns a copy of this date with a different time zone, preserving the day The returned object will have a local time of midnight in the new zone on the same day as the original instant.
Parameters:
  newZone - the new time zone, null means default a copy of this instant with a different time zone



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.