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

TimeOfDay
final public class TimeOfDay extends BasePartial implements ReadablePartial,Serializable(Code)
TimeOfDay is an immutable partial supporting the hour, minute, second and millisecond fields.

NOTE: This class only supports the four fields listed above. Thus, you cannot query the millisOfDay or secondOfDay fields for example. The new LocalTime class removes this restriction.

Calculations on TimeOfDay 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:

  • getHourOfDay()
  • hourOfDay().get()
The second technique also provides access to other useful methods on the field:
  • numeric value - hourOfDay().get()
  • text value - hourOfDay().getAsText()
  • short text value - hourOfDay().getAsShortText()
  • maximum/minimum values - hourOfDay().getMaximumValue()
  • add/subtract - hourOfDay().addToCopy()
  • set - hourOfDay().setCopy()

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


Inner Class :public static class Property extends AbstractPartialFieldProperty implements Serializable

Field Summary
final public static  intHOUR_OF_DAY
    
final public static  TimeOfDayMIDNIGHT
     Constant for midnight.
final public static  intMILLIS_OF_SECOND
    
final public static  intMINUTE_OF_HOUR
    
final public static  intSECOND_OF_MINUTE
    

Constructor Summary
public  TimeOfDay()
     Constructs a TimeOfDay with the current time, 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  TimeOfDay(DateTimeZone zone)
     Constructs a TimeOfDay with the current time, using ISOChronology in the specified zone to extract the fields.
public  TimeOfDay(Chronology chronology)
     Constructs a TimeOfDay with the current time, using the specified chronology and zone to extract the fields.
public  TimeOfDay(long instant)
     Constructs a TimeOfDay 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  TimeOfDay(long instant, Chronology chronology)
     Constructs a TimeOfDay extracting the partial fields from the specified milliseconds using the chronology provided.
public  TimeOfDay(Object instant)
     Constructs a TimeOfDay 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.timeParser .

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  TimeOfDay(Object instant, Chronology chronology)
     Constructs a TimeOfDay 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.timeParser .

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  TimeOfDay(int hourOfDay, int minuteOfHour)
     Constructs a TimeOfDay with specified hour and minute and zero seconds and milliseconds using ISOChronology in the default zone.
public  TimeOfDay(int hourOfDay, int minuteOfHour, Chronology chronology)
     Constructs a TimeOfDay with specified hour and minute and zero seconds and milliseconds.
public  TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute)
     Constructs a TimeOfDay with specified time field values and zero milliseconds using ISOChronology in the default zone.
public  TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute, Chronology chronology)
     Constructs a TimeOfDay with specified time field values and zero milliseconds.
public  TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
     Constructs a TimeOfDay with specified time field values using ISOChronology in the default zone.
public  TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, Chronology chronology)
     Constructs a TimeOfDay with specified time field values and chronology.
 TimeOfDay(TimeOfDay partial, int[] values)
     Constructs a TimeOfDay with chronology from this instance and new values.
 TimeOfDay(TimeOfDay partial, Chronology chrono)
     Constructs a TimeOfDay with values from this instance and a new chronology.

Method Summary
public static  TimeOfDayfromCalendarFields(Calendar calendar)
     Constructs a TimeOfDay 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 TimeOfDay. This is useful to ensure that the field values are the same in the created TimeOfDay no matter what the time zone is.

public static  TimeOfDayfromDateFields(Date date)
     Constructs a TimeOfDay 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 TimeOfDay. This is useful to ensure that the field values are the same in the created TimeOfDay no matter what the time zone is.

public static  TimeOfDayfromMillisOfDay(long millisOfDay)
     Constructs a TimeOfDay from the specified millis of day using the ISO chronology.
public static  TimeOfDayfromMillisOfDay(long millisOfDay, Chronology chrono)
     Constructs a TimeOfDay from the specified millis of day using the specified chronology.
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  intgetHourOfDay()
     Get the hour of day (0-23) field value.
public  intgetMillisOfSecond()
     Get the millis of second field value.
public  intgetMinuteOfHour()
     Get the minute of hour field value.
public  intgetSecondOfMinute()
     Get the second of minute field value.
public  PropertyhourOfDay()
     Get the hour of day field property which provides access to advanced functionality.
public  PropertymillisOfSecond()
     Get the millis of second property which provides access to advanced functionality.
public  TimeOfDayminus(ReadablePeriod period)
     Returns a copy of this time with the specified period taken away, wrapping to what would be a new day if required.
public  TimeOfDayminusHours(int hours)
     Returns a copy of this time minus the specified number of hours.
public  TimeOfDayminusMillis(int millis)
     Returns a copy of this time minus the specified number of millis.
public  TimeOfDayminusMinutes(int minutes)
     Returns a copy of this time minus the specified number of minutes.
public  TimeOfDayminusSeconds(int seconds)
     Returns a copy of this time minus the specified number of seconds.
public  PropertyminuteOfHour()
     Get the minute of hour field property which provides access to advanced functionality.
public  TimeOfDayplus(ReadablePeriod period)
     Returns a copy of this time with the specified period added, wrapping to what would be a new day if required.
public  TimeOfDayplusHours(int hours)
     Returns a copy of this time plus the specified number of hours.
public  TimeOfDayplusMillis(int millis)
     Returns a copy of this time plus the specified number of millis.
public  TimeOfDayplusMinutes(int minutes)
     Returns a copy of this time plus the specified number of minutes.
public  TimeOfDayplusSeconds(int seconds)
     Returns a copy of this time plus the specified number of seconds.
public  Propertyproperty(DateTimeFieldType type)
     Gets the property object for the specified type, which contains many useful methods.
public  PropertysecondOfMinute()
     Get the second of minute field property which provides access to advanced functionality.
public  intsize()
     Gets the number of fields in this partial.
public  DateTimetoDateTimeToday()
     Converts this partial to a full datetime using the default time zone setting the time fields from this instance and the date fields from the current time.
public  DateTimetoDateTimeToday(DateTimeZone zone)
     Converts this partial to a full datetime using the specified time zone setting the time fields from this instance and the date fields from the current time.
public  LocalTimetoLocalTime()
     Converts this object to a LocalTime with the same time and chronology.
public  StringtoString()
     Output the time in the ISO8601 format THH:mm:ss.SSS.
public  TimeOfDaywithChronologyRetainFields(Chronology newChronology)
     Returns a copy of this time with the specified chronology.
public  TimeOfDaywithField(DateTimeFieldType fieldType, int value)
     Returns a copy of this time with the specified field set to a new value.
public  TimeOfDaywithFieldAdded(DurationFieldType fieldType, int amount)
     Returns a copy of this time with the value of the specified field increased, wrapping to what would be a new day if required.
public  TimeOfDaywithHourOfDay(int hour)
     Returns a copy of this time with the hour of day field updated.
public  TimeOfDaywithMillisOfSecond(int millis)
     Returns a copy of this time with the millis of second field updated.
public  TimeOfDaywithMinuteOfHour(int minute)
     Returns a copy of this time with the minute of hour field updated.
public  TimeOfDaywithPeriodAdded(ReadablePeriod period, int scalar)
     Returns a copy of this time with the specified period added, wrapping to what would be a new day if required.

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  TimeOfDaywithSecondOfMinute(int second)
     Returns a copy of this time with the second of minute field updated.

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



MIDNIGHT
final public static TimeOfDay MIDNIGHT(Code)
Constant for midnight.



MILLIS_OF_SECOND
final public static int MILLIS_OF_SECOND(Code)
The index of the millisOfSecond field in the field array



MINUTE_OF_HOUR
final public static int MINUTE_OF_HOUR(Code)
The index of the minuteOfHour field in the field array



SECOND_OF_MINUTE
final public static int SECOND_OF_MINUTE(Code)
The index of the secondOfMinute field in the field array




Constructor Detail
TimeOfDay
public TimeOfDay()(Code)
Constructs a TimeOfDay with the current time, 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).




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

The constructor uses the specified time zone to obtain the current time. 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




TimeOfDay
public TimeOfDay(Chronology chronology)(Code)
Constructs a TimeOfDay with the current time, 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




TimeOfDay
public TimeOfDay(long instant)(Code)
Constructs a TimeOfDay 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




TimeOfDay
public TimeOfDay(long instant, Chronology chronology)(Code)
Constructs a TimeOfDay 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




TimeOfDay
public TimeOfDay(Object instant)(Code)
Constructs a TimeOfDay 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.timeParser .

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




TimeOfDay
public TimeOfDay(Object instant, Chronology chronology)(Code)
Constructs a TimeOfDay 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.timeParser .

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




TimeOfDay
public TimeOfDay(int hourOfDay, int minuteOfHour)(Code)
Constructs a TimeOfDay with specified hour and minute and zero seconds and milliseconds 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:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour




TimeOfDay
public TimeOfDay(int hourOfDay, int minuteOfHour, Chronology chronology)(Code)
Constructs a TimeOfDay with specified hour and minute and zero seconds and milliseconds.

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:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour
Parameters:
  chronology - the chronology, null means ISOChronology in the default zone




TimeOfDay
public TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute)(Code)
Constructs a TimeOfDay with specified time field values and zero milliseconds 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:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour
Parameters:
  secondOfMinute - the second of the minute




TimeOfDay
public TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute, Chronology chronology)(Code)
Constructs a TimeOfDay with specified time field values and zero milliseconds.

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:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour
Parameters:
  secondOfMinute - the second of the minute
Parameters:
  chronology - the chronology, null means ISOChronology in the default zone




TimeOfDay
public TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)(Code)
Constructs a TimeOfDay 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:
  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




TimeOfDay
public TimeOfDay(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, Chronology chronology)(Code)
Constructs a TimeOfDay with specified time field values and chronology.

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:
  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 the default zone




TimeOfDay
TimeOfDay(TimeOfDay partial, int[] values)(Code)
Constructs a TimeOfDay 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



TimeOfDay
TimeOfDay(TimeOfDay partial, Chronology chrono)(Code)
Constructs a TimeOfDay 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
fromCalendarFields
public static TimeOfDay fromCalendarFields(Calendar calendar)(Code)
Constructs a TimeOfDay 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 TimeOfDay. This is useful to ensure that the field values are the same in the created TimeOfDay no matter what the time zone is. For example, if the Calendar states that the time is 04:29, then the created TimeOfDay will always have the time 04:29 irrespective of time zone issues.

This factory method ignores the type of the calendar and always creates a TimeOfDay with ISO chronology.
Parameters:
  calendar - the Calendar to extract fields from the created TimeOfDay
throws:
  IllegalArgumentException - if the calendar is null
throws:
  IllegalArgumentException - if the time is invalid for the ISO chronology
since:
   1.2




fromDateFields
public static TimeOfDay fromDateFields(Date date)(Code)
Constructs a TimeOfDay 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 TimeOfDay. This is useful to ensure that the field values are the same in the created TimeOfDay no matter what the time zone is. For example, if the Calendar states that the time is 04:29, then the created TimeOfDay will always have the time 04:29 irrespective of time zone issues.

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




fromMillisOfDay
public static TimeOfDay fromMillisOfDay(long millisOfDay)(Code)
Constructs a TimeOfDay from the specified millis of day using the ISO chronology.

The millisOfDay value may exceed the number of millis in one day, but additional days will be ignored. This method uses the UTC time zone internally.
Parameters:
  millisOfDay - the number of milliseconds into a day to convert




fromMillisOfDay
public static TimeOfDay fromMillisOfDay(long millisOfDay, Chronology chrono)(Code)
Constructs a TimeOfDay from the specified millis of day using the specified chronology.

The millisOfDay value may exceed the number of millis in one day, but additional days will be ignored. This method uses the UTC time zone internally.
Parameters:
  millisOfDay - the number of milliseconds into a day to convert
Parameters:
  chrono - the chronology, null means ISO chronology




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, Hour, Minute, Second, Millis. the array of field types (cloned), largest to smallest




getHourOfDay
public int getHourOfDay()(Code)
Get the hour of day (0-23) field value. the hour of day



getMillisOfSecond
public int getMillisOfSecond()(Code)
Get the millis of second field value. the millis of second



getMinuteOfHour
public int getMinuteOfHour()(Code)
Get the minute of hour field value. the minute of hour



getSecondOfMinute
public int getSecondOfMinute()(Code)
Get the second of minute field value. the second of minute



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



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



minus
public TimeOfDay minus(ReadablePeriod period)(Code)
Returns a copy of this time with the specified period taken away, wrapping to what would be a new day if required.

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 TimeOfDay.minusHours(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 time exceeds capacity




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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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



plus
public TimeOfDay plus(ReadablePeriod period)(Code)
Returns a copy of this time with the specified period added, wrapping to what would be a new day if required.

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 TimeOfDay.plusHours(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




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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

Parameters:
  seconds - the amount of seconds to add, may be negative the new time plus the increased seconds
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



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



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



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



toDateTimeToday
public DateTime toDateTimeToday(DateTimeZone zone)(Code)
Converts this partial to a full datetime using the specified time zone setting the time fields from this instance and the date 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




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



toString
public String toString()(Code)
Output the time in the ISO8601 format THH:mm:ss.SSS. ISO8601 formatted string



withChronologyRetainFields
public TimeOfDay withChronologyRetainFields(Chronology newChronology)(Code)
Returns a copy of this time 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 TimeOfDay 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




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

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

These three lines are equivalent:

 TimeOfDay updated = tod.withField(DateTimeFieldType.minuteOfHour(), 6);
 TimeOfDay updated = tod.minuteOfHour().setCopy(6);
 TimeOfDay updated = tod.property(DateTimeFieldType.minuteOfHour()).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 TimeOfDay withFieldAdded(DurationFieldType fieldType, int amount)(Code)
Returns a copy of this time with the value of the specified field increased, wrapping to what would be a new day if required.

If the addition is zero, then this is returned.

These three lines are equivalent:

 TimeOfDay added = tod.withFieldAdded(DurationFieldType.minutes(), 6);
 TimeOfDay added = tod.plusMinutes(6);
 TimeOfDay added = tod.minuteOfHour().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



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

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




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

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




withMinuteOfHour
public TimeOfDay withMinuteOfHour(int minute)(Code)
Returns a copy of this time with the minute of hour field updated.

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




withPeriodAdded
public TimeOfDay withPeriodAdded(ReadablePeriod period, int scalar)(Code)
Returns a copy of this time with the specified period added, wrapping to what would be a new day if required.

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 TimeOfDay.withFieldAdded(DurationFieldType,int) or TimeOfDay.plusHours(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




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

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




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.