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

MutableDateTime
public class MutableDateTime extends BaseDateTime implements ReadWritableDateTime,Cloneable,Serializable(Code)
MutableDateTime is the standard implementation of a modifiable datetime class. It holds the datetime as milliseconds from the Java epoch of 1970-01-01T00:00:00Z.

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

Each individual field can be accessed in two ways:

  • getHourOfDay()
  • hourOfDay().get()
The second technique also provides access to other useful methods on the field:
  • get numeric value
  • set numeric value
  • add to numeric value
  • add to numeric value wrapping with the field
  • get text vlaue
  • get short text value
  • set text value
  • field maximum value
  • field minimum value

MutableDateTime is mutable and not thread-safe, unless concurrent threads are not invoking mutator methods.
author:
   Guy Allard
author:
   Brian S O'Neill
author:
   Stephen Colebourne
author:
   Mike Schrag
since:
   1.0
See Also:   DateTime


Inner Class :final public static class Property extends AbstractReadableInstantFieldProperty

Field Summary
final public static  intROUND_CEILING
    
final public static  intROUND_FLOOR
    
final public static  intROUND_HALF_CEILING
    
final public static  intROUND_HALF_EVEN
    
final public static  intROUND_HALF_FLOOR
    
final public static  intROUND_NONE
    

Constructor Summary
public  MutableDateTime()
     Constructs an instance set to the current system millisecond time using ISOChronology in the default time zone.
public  MutableDateTime(DateTimeZone zone)
     Constructs an instance set to the current system millisecond time using ISOChronology in the specified time zone.
public  MutableDateTime(Chronology chronology)
     Constructs an instance set to the current system millisecond time using the specified chronology.
public  MutableDateTime(long instant)
     Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using ISOChronology in the default time zone.
public  MutableDateTime(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  MutableDateTime(long instant, Chronology chronology)
     Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using the specified chronology.
public  MutableDateTime(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  MutableDateTime(Object instant, DateTimeZone zone)
     Constructs an instance from an Object that represents a datetime, forcing the time zone to that specified.
public  MutableDateTime(Object instant, Chronology chronology)
     Constructs an instance from an Object that represents a datetime, using the specified chronology.
public  MutableDateTime(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  MutableDateTime(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  MutableDateTime(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  voidadd(long duration)
     Add an amount of time to the datetime.
public  voidadd(ReadableDuration duration)
     Adds a duration to this instant.
public  voidadd(ReadableDuration duration, int scalar)
     Adds a duration to this instant specifying how many times to add.
public  voidadd(ReadablePeriod period)
     Adds a period to this instant.
public  voidadd(ReadablePeriod period, int scalar)
     Adds a period to this instant specifying how many times to add.
public  voidadd(DurationFieldType type, int amount)
     Adds to the instant specifying the duration and multiple to add.
public  voidaddDays(int days)
     Add a number of days to the date.
public  voidaddHours(int hours)
     Add a number of hours to the date.
public  voidaddMillis(int millis)
     Add a number of milliseconds to the date.
public  voidaddMinutes(int minutes)
     Add a number of minutes to the date.
public  voidaddMonths(int months)
     Add a number of months to the date.
public  voidaddSeconds(int seconds)
     Add a number of seconds to the date.
public  voidaddWeeks(int weeks)
     Add a number of weeks to the date.
public  voidaddWeekyears(int weekyears)
     Add a number of weekyears to the date.
public  voidaddYears(int years)
     Add a number of years to the date.
public  PropertycenturyOfEra()
     Get the century of era property.
public  Objectclone()
     Clone this object.
public  MutableDateTimecopy()
     Clone this object without having to cast the returned object.
public  PropertydayOfMonth()
     Get the day of month property.
public  PropertydayOfWeek()
     Get the day of week property.
public  PropertydayOfYear()
     Get the day of year property.
public  Propertyera()
     Get the era property.
public  DateTimeFieldgetRoundingField()
     Gets the field used for rounding this instant, returning null if rounding is not enabled.
public  intgetRoundingMode()
     Gets the rounding mode for this instant, returning ROUND_NONE if rounding is not enabled.
public  PropertyhourOfDay()
    
public  PropertymillisOfDay()
    
public  PropertymillisOfSecond()
    
public  PropertyminuteOfDay()
    
public  PropertyminuteOfHour()
    
public  PropertymonthOfYear()
     Get the month of year property.
public  Propertyproperty(DateTimeFieldType type)
     Gets the property object for the specified type, which contains many useful methods.
public  PropertysecondOfDay()
    
public  PropertysecondOfMinute()
    
public  voidset(DateTimeFieldType type, int value)
     Sets the value of one of the fields of the instant, such as hourOfDay.
public  voidsetChronology(Chronology chronology)
     Set the chronology of the datetime.
public  voidsetDate(long instant)
     Set the date from milliseconds.
public  voidsetDate(ReadableInstant instant)
     Set the date from another instant.
public  voidsetDate(int year, int monthOfYear, int dayOfMonth)
     Set the date from fields.
public  voidsetDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
     Set the date and time from fields.
public  voidsetDayOfMonth(int dayOfMonth)
     Set the day of the month to the specified value.
public  voidsetDayOfWeek(int dayOfWeek)
     Set the day of week to the specified value.
public  voidsetDayOfYear(int dayOfYear)
     Set the day of year to the specified value.
public  voidsetHourOfDay(int hourOfDay)
     Set the hour of the day to the specified value.
public  voidsetMillis(long instant)
     Set the milliseconds of the datetime.
public  voidsetMillis(ReadableInstant instant)
     Sets the millisecond instant of this instant from another.
public  voidsetMillisOfDay(int millisOfDay)
     Set the millis of the day to the specified value.
public  voidsetMillisOfSecond(int millisOfSecond)
     Set the millis of the second to the specified value.
public  voidsetMinuteOfDay(int minuteOfDay)
     Set the minute of the day to the specified value.
public  voidsetMinuteOfHour(int minuteOfHour)
     Set the minute of the hour to the specified value.
public  voidsetMonthOfYear(int monthOfYear)
     Set the month of the year to the specified value.
public  voidsetRounding(DateTimeField field)
     Sets the status of rounding to use the specified field and ROUND_FLOOR mode. A null field will disable rounding. Once set, the instant is then rounded using the new field and mode.

Enabling rounding will cause all subsequent calls to MutableDateTime.setMillis(long) to be rounded.

public  voidsetRounding(DateTimeField field, int mode)
     Sets the status of rounding to use the specified field and mode. A null field or mode of ROUND_NONE will disable rounding. Once set, the instant is then rounded using the new field and mode.

Enabling rounding will cause all subsequent calls to MutableDateTime.setMillis(long) to be rounded.

public  voidsetSecondOfDay(int secondOfDay)
     Set the second of the day to the specified value.
public  voidsetSecondOfMinute(int secondOfMinute)
     Set the second of the minute to the specified value.
public  voidsetTime(long millis)
     Set the time from milliseconds.
public  voidsetTime(ReadableInstant instant)
     Set the time from another instant.
public  voidsetTime(int hour, int minuteOfHour, int secondOfMinute, int millisOfSecond)
     Set the time from fields.
public  voidsetWeekOfWeekyear(int weekOfWeekyear)
     Set the week of weekyear to the specified value.
public  voidsetWeekyear(int weekyear)
     Set the weekyear to the specified value.
public  voidsetYear(int year)
     Set the year to the specified value.
public  voidsetZone(DateTimeZone newZone)
     Sets the time zone of the datetime, changing the chronology and field values.

Changing the zone using this method retains the millisecond instant. The millisecond instant is adjusted in the new zone to compensate. chronology.

public  voidsetZoneRetainFields(DateTimeZone newZone)
     Sets the time zone of the datetime, changing the chronology and millisecond.
public  StringtoString()
     Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZ).
public  PropertyweekOfWeekyear()
     Get the week of a week based year property.
public  Propertyweekyear()
     Get the year of a week based year property.
public  Propertyyear()
     Get the year property.
public  PropertyyearOfCentury()
     Get the year of century property.
public  PropertyyearOfEra()
     Get the year of era property.

Field Detail
ROUND_CEILING
final public static int ROUND_CEILING(Code)
Rounding mode as described by DateTimeField.roundCeiling



ROUND_FLOOR
final public static int ROUND_FLOOR(Code)
Rounding mode as described by DateTimeField.roundFloor



ROUND_HALF_CEILING
final public static int ROUND_HALF_CEILING(Code)
Rounding mode as described by DateTimeField.roundHalfCeiling



ROUND_HALF_EVEN
final public static int ROUND_HALF_EVEN(Code)
Rounding mode as described by DateTimeField.roundHalfEven



ROUND_HALF_FLOOR
final public static int ROUND_HALF_FLOOR(Code)
Rounding mode as described by DateTimeField.roundHalfFloor



ROUND_NONE
final public static int ROUND_NONE(Code)
Rounding is disabled




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



MutableDateTime
public MutableDateTime(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




MutableDateTime
public MutableDateTime(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




MutableDateTime
public MutableDateTime(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



MutableDateTime
public MutableDateTime(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




MutableDateTime
public MutableDateTime(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




MutableDateTime
public MutableDateTime(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.
Parameters:
  instant - the datetime object, null means now
throws:
  IllegalArgumentException - if the instant is invalid




MutableDateTime
public MutableDateTime(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.
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




MutableDateTime
public MutableDateTime(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.
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




MutableDateTime
public MutableDateTime(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



MutableDateTime
public MutableDateTime(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




MutableDateTime
public MutableDateTime(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
add
public void add(long duration)(Code)
Add an amount of time to the datetime.
Parameters:
  duration - the millis to add
throws:
  ArithmeticException - if the result exceeds the capacity of the instant



add
public void add(ReadableDuration duration)(Code)
Adds a duration to this instant.

This will typically change the value of most fields.
Parameters:
  duration - the duration to add, null means add zero
throws:
  ArithmeticException - if the result exceeds the capacity of the instant




add
public void add(ReadableDuration duration, int scalar)(Code)
Adds a duration to this instant specifying how many times to add.

This will typically change the value of most fields.
Parameters:
  duration - the duration to add, null means add zero
Parameters:
  scalar - direction and amount to add, which may be negative
throws:
  ArithmeticException - if the result exceeds the capacity of the instant




add
public void add(ReadablePeriod period)(Code)
Adds a period to this instant.

This will typically change the value of most fields.
Parameters:
  period - the period to add, null means add zero
throws:
  ArithmeticException - if the result exceeds the capacity of the instant




add
public void add(ReadablePeriod period, int scalar)(Code)
Adds a period to this instant specifying how many times to add.

This will typically change the value of most fields.
Parameters:
  period - the period to add, null means add zero
Parameters:
  scalar - direction and amount to add, which may be negative
throws:
  ArithmeticException - if the result exceeds the capacity of the instant




add
public void add(DurationFieldType type, int amount)(Code)
Adds to the instant specifying the duration and multiple to add.
Parameters:
  type - a field type, usually obtained from DateTimeFieldType, not null
Parameters:
  amount - the amount to add of this duration
throws:
  IllegalArgumentException - if the value is null or invalid
throws:
  ArithmeticException - if the result exceeds the capacity of the instant



addDays
public void addDays(int days)(Code)
Add a number of days to the date.
Parameters:
  days - the days to add
throws:
  IllegalArgumentException - if the value is invalid



addHours
public void addHours(int hours)(Code)
Add a number of hours to the date.
Parameters:
  hours - the hours to add
throws:
  IllegalArgumentException - if the value is invalid



addMillis
public void addMillis(int millis)(Code)
Add a number of milliseconds to the date. The implementation of this method differs from the MutableDateTime.add(long) method in that a DateTimeField performs the addition.
Parameters:
  millis - the milliseconds to add
throws:
  IllegalArgumentException - if the value is invalid



addMinutes
public void addMinutes(int minutes)(Code)
Add a number of minutes to the date.
Parameters:
  minutes - the minutes to add
throws:
  IllegalArgumentException - if the value is invalid



addMonths
public void addMonths(int months)(Code)
Add a number of months to the date.
Parameters:
  months - the months to add
throws:
  IllegalArgumentException - if the value is invalid



addSeconds
public void addSeconds(int seconds)(Code)
Add a number of seconds to the date.
Parameters:
  seconds - the seconds to add
throws:
  IllegalArgumentException - if the value is invalid



addWeeks
public void addWeeks(int weeks)(Code)
Add a number of weeks to the date.
Parameters:
  weeks - the weeks to add
throws:
  IllegalArgumentException - if the value is invalid



addWeekyears
public void addWeekyears(int weekyears)(Code)
Add a number of weekyears to the date.
Parameters:
  weekyears - the weekyears to add
throws:
  IllegalArgumentException - if the value is invalid



addYears
public void addYears(int years)(Code)
Add a number of years to the date.
Parameters:
  years - the years to add
throws:
  IllegalArgumentException - if the value is invalid



centuryOfEra
public Property centuryOfEra()(Code)
Get the century of era property. the year of era property



clone
public Object clone()(Code)
Clone this object. a clone of this object.



copy
public MutableDateTime copy()(Code)
Clone this object without having to cast the returned object. a clone of the this object.



dayOfMonth
public Property dayOfMonth()(Code)
Get the day of month property.

The values for day of month are defined in DateTimeConstants . the day of month property




dayOfWeek
public Property dayOfWeek()(Code)
Get the day of week property.

The values for day of week are defined in DateTimeConstants . the day of week property




dayOfYear
public Property dayOfYear()(Code)
Get the day of year property. the day of year property



era
public Property era()(Code)
Get the era property. the era property



getRoundingField
public DateTimeField getRoundingField()(Code)
Gets the field used for rounding this instant, returning null if rounding is not enabled. the rounding field



getRoundingMode
public int getRoundingMode()(Code)
Gets the rounding mode for this instant, returning ROUND_NONE if rounding is not enabled. the rounding mode constant



hourOfDay
public Property hourOfDay()(Code)
Get the hour of day field property the hour of day property



millisOfDay
public Property millisOfDay()(Code)
Get the millis of day property the millis of day property



millisOfSecond
public Property millisOfSecond()(Code)
Get the millis of second property the millis of second property



minuteOfDay
public Property minuteOfDay()(Code)
Get the minute of day property the minute of day property



minuteOfHour
public Property minuteOfHour()(Code)
Get the minute of hour field property the minute of hour property



monthOfYear
public Property monthOfYear()(Code)
Get the month of year property. the month of year property



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



secondOfDay
public Property secondOfDay()(Code)
Get the second of day property the second of day property



secondOfMinute
public Property secondOfMinute()(Code)
Get the second of minute field property the second of minute property



set
public void set(DateTimeFieldType type, int value)(Code)
Sets the value of one of the fields of the instant, such as hourOfDay.
Parameters:
  type - a field type, usually obtained from DateTimeFieldType, not null
Parameters:
  value - the value to set the field to
throws:
  IllegalArgumentException - if the value is null or invalid



setChronology
public void setChronology(Chronology chronology)(Code)
Set the chronology of the datetime.

All changes to the chronology occur via this method.
Parameters:
  chronology - the chronology to use, null means ISOChronology in default zone




setDate
public void setDate(long instant)(Code)
Set the date from milliseconds. The time part of this object will be unaffected.
Parameters:
  instant - an instant to copy the date from, time part ignored
throws:
  IllegalArgumentException - if the value is invalid



setDate
public void setDate(ReadableInstant instant)(Code)
Set the date from another instant. The time part of this object will be unaffected.
Parameters:
  instant - an instant to copy the date from, time part ignored
throws:
  IllegalArgumentException - if the object is invalid



setDate
public void setDate(int year, int monthOfYear, int dayOfMonth)(Code)
Set the date from fields. The time part of this object will be unaffected.
Parameters:
  year - the year
Parameters:
  monthOfYear - the month of the year
Parameters:
  dayOfMonth - the day of the month
throws:
  IllegalArgumentException - if the value is invalid



setDateTime
public void setDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)(Code)
Set the date and time from fields.
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
throws:
  IllegalArgumentException - if the value is invalid



setDayOfMonth
public void setDayOfMonth(int dayOfMonth)(Code)
Set the day of the month to the specified value.
Parameters:
  dayOfMonth - the day of the month
throws:
  IllegalArgumentException - if the value is invalid



setDayOfWeek
public void setDayOfWeek(int dayOfWeek)(Code)
Set the day of week to the specified value.
Parameters:
  dayOfWeek - the day of the week
throws:
  IllegalArgumentException - if the value is invalid



setDayOfYear
public void setDayOfYear(int dayOfYear)(Code)
Set the day of year to the specified value.
Parameters:
  dayOfYear - the day of the year
throws:
  IllegalArgumentException - if the value is invalid



setHourOfDay
public void setHourOfDay(int hourOfDay)(Code)
Set the hour of the day to the specified value.
Parameters:
  hourOfDay - the hour of day
throws:
  IllegalArgumentException - if the value is invalid



setMillis
public void setMillis(long instant)(Code)
Set the milliseconds of the datetime.

All changes to the millisecond field occurs via this method.
Parameters:
  instant - the milliseconds since 1970-01-01T00:00:00Z to set thedatetime to




setMillis
public void setMillis(ReadableInstant instant)(Code)
Sets the millisecond instant of this instant from another.

This method does not change the chronology of this instant, just the millisecond instant.
Parameters:
  instant - the instant to use, null means now




setMillisOfDay
public void setMillisOfDay(int millisOfDay)(Code)
Set the millis of the day to the specified value.
Parameters:
  millisOfDay - the millis of day
throws:
  IllegalArgumentException - if the value is invalid



setMillisOfSecond
public void setMillisOfSecond(int millisOfSecond)(Code)
Set the millis of the second to the specified value.
Parameters:
  millisOfSecond - the millis of second
throws:
  IllegalArgumentException - if the value is invalid



setMinuteOfDay
public void setMinuteOfDay(int minuteOfDay)(Code)
Set the minute of the day to the specified value.
Parameters:
  minuteOfDay - the minute of day
throws:
  IllegalArgumentException - if the value is invalid



setMinuteOfHour
public void setMinuteOfHour(int minuteOfHour)(Code)
Set the minute of the hour to the specified value.
Parameters:
  minuteOfHour - the minute of hour
throws:
  IllegalArgumentException - if the value is invalid



setMonthOfYear
public void setMonthOfYear(int monthOfYear)(Code)
Set the month of the year to the specified value.
Parameters:
  monthOfYear - the month of the year
throws:
  IllegalArgumentException - if the value is invalid



setRounding
public void setRounding(DateTimeField field)(Code)
Sets the status of rounding to use the specified field and ROUND_FLOOR mode. A null field will disable rounding. Once set, the instant is then rounded using the new field and mode.

Enabling rounding will cause all subsequent calls to MutableDateTime.setMillis(long) to be rounded. This can be used to control the precision of the instant, for example by setting a rounding field of minuteOfDay, the seconds and milliseconds will always be zero.
Parameters:
  field - rounding field or null to disable




setRounding
public void setRounding(DateTimeField field, int mode)(Code)
Sets the status of rounding to use the specified field and mode. A null field or mode of ROUND_NONE will disable rounding. Once set, the instant is then rounded using the new field and mode.

Enabling rounding will cause all subsequent calls to MutableDateTime.setMillis(long) to be rounded. This can be used to control the precision of the instant, for example by setting a rounding field of minuteOfDay, the seconds and milliseconds will always be zero.
Parameters:
  field - rounding field or null to disable
Parameters:
  mode - rounding mode or ROUND_NONE to disable
throws:
  IllegalArgumentException - if mode is unknown, no exception if field is null




setSecondOfDay
public void setSecondOfDay(int secondOfDay)(Code)
Set the second of the day to the specified value.
Parameters:
  secondOfDay - the second of day
throws:
  IllegalArgumentException - if the value is invalid



setSecondOfMinute
public void setSecondOfMinute(int secondOfMinute)(Code)
Set the second of the minute to the specified value.
Parameters:
  secondOfMinute - the second of minute
throws:
  IllegalArgumentException - if the value is invalid



setTime
public void setTime(long millis)(Code)
Set the time from milliseconds. The date part of this object will be unaffected.
Parameters:
  millis - an instant to copy the time from, date part ignored
throws:
  IllegalArgumentException - if the value is invalid



setTime
public void setTime(ReadableInstant instant)(Code)
Set the time from another instant. The date part of this object will be unaffected.
Parameters:
  instant - an instant to copy the time from, date part ignored
throws:
  IllegalArgumentException - if the object is invalid



setTime
public void setTime(int hour, int minuteOfHour, int secondOfMinute, int millisOfSecond)(Code)
Set the time from fields. The date part of this object will be unaffected.
Parameters:
  hour - the hour
Parameters:
  minuteOfHour - the minute of the hour
Parameters:
  secondOfMinute - the second of the minute
Parameters:
  millisOfSecond - the millisecond of the second
throws:
  IllegalArgumentException - if the value is invalid



setWeekOfWeekyear
public void setWeekOfWeekyear(int weekOfWeekyear)(Code)
Set the week of weekyear to the specified value.
Parameters:
  weekOfWeekyear - the week of the weekyear
throws:
  IllegalArgumentException - if the value is invalid



setWeekyear
public void setWeekyear(int weekyear)(Code)
Set the weekyear to the specified value.
Parameters:
  weekyear - the weekyear
throws:
  IllegalArgumentException - if the value is invalid



setYear
public void setYear(int year)(Code)
Set the year to the specified value.
Parameters:
  year - the year
throws:
  IllegalArgumentException - if the value is invalid



setZone
public void setZone(DateTimeZone newZone)(Code)
Sets the time zone of the datetime, changing the chronology and field values.

Changing the zone using this method retains the millisecond instant. The millisecond instant is adjusted in the new zone to compensate. chronology. Setting the time zone does not affect the millisecond value of this instant.

If the chronology already has this time zone, no change occurs.
Parameters:
  newZone - the time zone to use, null means default zone
See Also:   MutableDateTime.setZoneRetainFields




setZoneRetainFields
public void setZoneRetainFields(DateTimeZone newZone)(Code)
Sets the time zone of the datetime, changing the chronology and millisecond.

Changing the zone using this method retains the field values. The millisecond instant is adjusted in the new zone to compensate.

If the chronology already has this time zone, no change occurs.
Parameters:
  newZone - the time zone to use, null means default zone
See Also:   MutableDateTime.setZone




toString
public String toString()(Code)
Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZ). ISO8601 time formatted string.



weekOfWeekyear
public Property weekOfWeekyear()(Code)
Get the week of a week based year property. the week of a week based year property



weekyear
public Property weekyear()(Code)
Get the year of a week based year property. the year of a week based year property



year
public Property year()(Code)
Get the year property. the year property



yearOfCentury
public Property yearOfCentury()(Code)
Get the year of century property. the year of era property



yearOfEra
public Property yearOfEra()(Code)
Get the year of era property. 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.