Joda Time API

org.joda.time
Interface ReadWritableInstant

All Superinterfaces:
java.lang.Comparable, ReadableInstant
All Known Implementing Classes:
MutableDateTime

public interface ReadWritableInstant
extends ReadableInstant

Writable interface for an instant in the datetime continuum.

This interface expresses the datetime as milliseconds from 1970-01-01T00:00:00Z.

Since:
1.0
Author:
Stephen Colebourne

Method Summary
 void add(DateTimeField field, int value)
          Add to the value of one of the fields of a datetime.
 void add(java.lang.Object object)
          Add an amount of time, either a ReadableDuration or Long (millis).
 void addMillis(long millis)
          Add a number of millis to the value.
 void addWrapped(DateTimeField field, int value)
          Add to the value of one of the fields of a datetime, wrapping within that field.
 void set(DateTimeField field, int value)
          Set the value of one of the fields of a datetime.
 void setMillis(long millis)
          Set the value as the number of miliseconds since the epoch, 1970-01-01T00:00:00Z.
 void setMillis(java.lang.Object obj)
          Set the value from Date, Calendar, DateTime etc.
 
Methods inherited from interface org.joda.time.ReadableInstant
compareTo, equals, get, getChronology, getDateTimeZone, getMillis, hashCode, isAfter, isBefore, isEqual, toCopy, toCopy, toInstant, toString
 

Method Detail

setMillis

public void setMillis(long millis)
Set the value as the number of miliseconds since the epoch, 1970-01-01T00:00:00Z.

Returns:
the value as milliseconds

setMillis

public void setMillis(java.lang.Object obj)
Set the value from Date, Calendar, DateTime etc.

Returns:
the value as a Calendar

add

public void add(java.lang.Object object)
Add an amount of time, either a ReadableDuration or Long (millis).

If the resulting value is too large for the implementation, an exception is thrown.

Parameters:
object - an object evaluating to an a period of time to add.

addMillis

public void addMillis(long millis)
Add a number of millis to the value.

If the resulting value is too large for millis, seconds will change and so on unless it is too large for the implementation, when an exception is thrown.

Parameters:
millis - the millis to add

set

public void set(DateTimeField field,
                int value)
Set the value of one of the fields of a datetime.

DateTimeField instances are generally obtained from a Chronology subclass. However, an application can create its own DateTimeField to manipulate the date time millis in new ways.

Parameters:
field - a DateTimeField instance, usually obtained from a Chronology
value - the value of that field for the millis set in the implementation

add

public void add(DateTimeField field,
                int value)
Add to the value of one of the fields of a datetime.

DateTimeField instances are generally obtained from a Chronology subclass. However, an application can create its own DateTimeField to manipulate the date time millis in new ways.

Parameters:
field - a DateTimeField instance, usually obtained from a Chronology
value - the value of that field for the millis set in the implementation

addWrapped

public void addWrapped(DateTimeField field,
                       int value)
Add to the value of one of the fields of a datetime, wrapping within that field.

For example, 2002-03-01 add 14 months gives 2003-05-01. But 2002-03-01 add wrapped 14 months gives 2002-05-01. This is similar to the roll method on Calendar.

DateTimeField instances are generally obtained from a Chronology subclass. However, an application can create its own DateTimeField to manipulate the date time millis in new ways.

Parameters:
field - a DateTimeField instance, usually obtained from a Chronology
value - the value of that field for the millis set in the implementation

Joda Time API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.