Java Doc for LocalTime.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.BaseLocal
   org.joda.time.LocalTime

LocalTime
final public class LocalTime extends BaseLocal implements ReadablePartial,Serializable(Code)
LocalTime is an immutable time class representing a time without a time zone.

LocalTime implements the ReadablePartial interface. To do this, the interface methods focus on the key fields - HourOfDay, MinuteOfHour, SecondOfMinute and MillisOfSecond. However, all time fields may in fact be queried.

Calculations on LocalTime are performed using a Chronology . This chronology will be set internally 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
  • text value
  • short text value
  • maximum/minimum values
  • add/subtract
  • set
  • rounding

LocalTime 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.3


Inner Class :final public static class Property extends AbstractReadableInstantFieldProperty

Field Summary
final public static  LocalTimeMIDNIGHT
     Constant for midnight.

Constructor Summary
public  LocalTime()
     Constructs an instance set to the current local time evaluated using ISO chronology in the default zone.
public  LocalTime(DateTimeZone zone)
     Constructs an instance set to the current local time evaluated using ISO chronology in the specified zone.
public  LocalTime(Chronology chronology)
     Constructs an instance set to the current local time evaluated using specified chronology and zone.
public  LocalTime(long instant)
     Constructs an instance set to the local time defined by the specified instant evaluated using ISO chronology in the default zone.
public  LocalTime(long instant, DateTimeZone zone)
     Constructs an instance set to the local time defined by the specified instant evaluated using ISO chronology in the specified zone.
public  LocalTime(long instant, Chronology chronology)
     Constructs an instance set to the local time defined by the specified instant evaluated using the specified chronology.
public  LocalTime(Object instant)
     Constructs an instance from an Object that represents a datetime.
public  LocalTime(Object instant, DateTimeZone zone)
     Constructs an instance from an Object that represents a datetime, forcing the time zone to that specified.
public  LocalTime(Object instant, Chronology chronology)
     Constructs an instance from an Object that represents a datetime, using the specified chronology.
public  LocalTime(int hourOfDay, int minuteOfHour)
     Constructs an instance set to the specified time using ISOChronology.
public  LocalTime(int hourOfDay, int minuteOfHour, int secondOfMinute)
     Constructs an instance set to the specified time using ISOChronology.
public  LocalTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
     Constructs an instance set to the specified time using ISOChronology.
public  LocalTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, Chronology chronology)
     Constructs an instance set to the specified time using the specified chronology, whose zone is ignored.

Method Summary
public  intcompareTo(Object partial)
     Compares this partial with another returning an integer indicating the order.
public  booleanequals(Object partial)
     Compares this ReadablePartial with another returning true if the chronology, field types and values are equal.
public static  LocalTimefromCalendarFields(Calendar calendar)
     Constructs a LocalTime 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 LocalTime. This is useful if you have been using the Calendar as a local time, ignoing the zone.

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

public static  LocalTimefromDateFields(Date date)
     Constructs a LocalTime from a java.util.Date using exactly the same field values avoiding any time zone effects.
public static  LocalTimefromMillisOfDay(long millisOfDay)
     Constructs a LocalTime from the specified millis of day using the ISO chronology.
public static  LocalTimefromMillisOfDay(long millisOfDay, Chronology chrono)
     Constructs a LocalTime from the specified millis of day using the specified chronology.
public  intget(DateTimeFieldType fieldType)
     Get the value of one of the fields of time.
public  ChronologygetChronology()
     Gets the chronology of the time.
protected  DateTimeFieldgetField(int index, Chronology chrono)
     Gets the field for a specific index in the chronology specified.
public  intgetHourOfDay()
     Get the hour of day field value.
protected  longgetLocalMillis()
     Gets the local milliseconds from the Java epoch of 1970-01-01T00:00:00 (not fixed to any specific time zone).
public  intgetMillisOfDay()
     Get the millis of day 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  intgetValue(int index)
     Gets the value of the field at the specifed index.

This method is required to support the ReadablePartial interface.

public  PropertyhourOfDay()
     Get the hour of day field property which provides access to advanced functionality.
public  booleanisSupported(DateTimeFieldType type)
     Checks if the field type specified is supported by this local time and chronology.
public  booleanisSupported(DurationFieldType type)
     Checks if the duration type specified is supported by this local time and chronology.
public  PropertymillisOfDay()
     Get the millis of day property which provides access to advanced functionality.
public  PropertymillisOfSecond()
     Get the millis of second property which provides access to advanced functionality.
public  LocalTimeminus(ReadablePeriod period)
     Returns a copy of this time with the specified period taken away.
public  LocalTimeminusHours(int hours)
     Returns a copy of this time minus the specified number of hours.
public  LocalTimeminusMillis(int millis)
     Returns a copy of this time minus the specified number of millis.
public  LocalTimeminusMinutes(int minutes)
     Returns a copy of this time minus the specified number of minutes.
public  LocalTimeminusSeconds(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  LocalTimeplus(ReadablePeriod period)
     Returns a copy of this time with the specified period added.
public  LocalTimeplusHours(int hours)
     Returns a copy of this time plus the specified number of hours.
public  LocalTimeplusMillis(int millis)
     Returns a copy of this time plus the specified number of millis.
public  LocalTimeplusMinutes(int minutes)
     Returns a copy of this time plus the specified number of minutes.
public  LocalTimeplusSeconds(int seconds)
     Returns a copy of this time plus the specified number of seconds.
public  Propertyproperty(DateTimeFieldType fieldType)
     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, which is four.
public  DateTimetoDateTimeToday()
     Converts this LocalTime to a full datetime using the default time zone setting the time fields from this instance and the date fields from the current date.
public  DateTimetoDateTimeToday(DateTimeZone zone)
     Converts this LocalTime 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  StringtoString()
     Output the time in ISO8601 format (HH:mm:ss.SSSZ).
public  StringtoString(String pattern)
     Output the time using the specified format pattern.
public  StringtoString(String pattern, Locale locale)
     Output the time using the specified format pattern.
public  LocalTimewithField(DateTimeFieldType fieldType, int value)
     Returns a copy of this time with the specified field set to a new value.
public  LocalTimewithFieldAdded(DurationFieldType fieldType, int amount)
     Returns a copy of this time with the value of the specified field increased.

If the addition is zero or the field is null, then this is returned.

If the addition causes the maximum value of the field to be exceeded, then the value will wrap.

public  LocalTimewithFields(ReadablePartial partial)
     Returns a copy of this time with the partial set of fields replacing those from this instance.
public  LocalTimewithHourOfDay(int hour)
     Returns a copy of this time with the hour of day field updated.
 LocalTimewithLocalMillis(long newMillis)
     Returns a copy of this time with different local millis.
public  LocalTimewithMillisOfDay(int millis)
     Returns a copy of this time with the millis of day field updated.
public  LocalTimewithMillisOfSecond(int millis)
     Returns a copy of this time with the millis of second field updated.
public  LocalTimewithMinuteOfHour(int minute)
     Returns a copy of this time with the minute of hour field updated.
public  LocalTimewithPeriodAdded(ReadablePeriod period, int scalar)
     Returns a copy of this time 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  LocalTimewithSecondOfMinute(int second)
     Returns a copy of this time with the second of minute field updated.

Field Detail
MIDNIGHT
final public static LocalTime MIDNIGHT(Code)
Constant for midnight.




Constructor Detail
LocalTime
public LocalTime()(Code)
Constructs an instance set to the current local time evaluated using ISO chronology in the default zone.

Once the constructor is completed, the zone is no longer used.




LocalTime
public LocalTime(DateTimeZone zone)(Code)
Constructs an instance set to the current local time evaluated using ISO chronology in the specified zone.

If the specified time zone is null, the default zone is used. Once the constructor is completed, the zone is no longer used.
Parameters:
  zone - the time zone, null means default zone




LocalTime
public LocalTime(Chronology chronology)(Code)
Constructs an instance set to the current local time evaluated using specified chronology and zone.

If the chronology is null, ISO chronology in the default time zone is used. Once the constructor is completed, the zone is no longer used.
Parameters:
  chronology - the chronology, null means ISOChronology in default zone




LocalTime
public LocalTime(long instant)(Code)
Constructs an instance set to the local time defined by the specified instant evaluated using ISO chronology in the default zone.

Once the constructor is completed, the zone is no longer used.
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z




LocalTime
public LocalTime(long instant, DateTimeZone zone)(Code)
Constructs an instance set to the local time defined by the specified instant evaluated using ISO chronology in the specified zone.

If the specified time zone is null, the default zone is used. Once the constructor is completed, the zone is no longer used.
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z
Parameters:
  zone - the time zone, null means default zone




LocalTime
public LocalTime(long instant, Chronology chronology)(Code)
Constructs an instance set to the local time defined by the specified instant evaluated using the specified chronology.

If the chronology is null, ISO chronology in the default zone is used. Once the constructor is completed, the zone is no longer used.
Parameters:
  instant - the milliseconds from 1970-01-01T00:00:00Z
Parameters:
  chronology - the chronology, null means ISOChronology in default zone




LocalTime
public LocalTime(Object instant)(Code)
Constructs an instance from an Object that represents a datetime.

If the object contains no chronology, ISOChronology is used. If the object contains no time zone, the default zone is used. Once the constructor is completed, the zone is no longer used.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadablePartial, ReadableInstant, String, Calendar and Date. The String formats are described by ISODateTimeFormat.localTimeParser . The default String converter ignores the zone and only parses the field values.
Parameters:
  instant - the datetime object
throws:
  IllegalArgumentException - if the instant is invalid




LocalTime
public LocalTime(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 contains no chronology, ISOChronology is used. If the specified time zone is null, the default zone is used. Once the constructor is completed, the zone is no longer used.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadablePartial, ReadableInstant, String, Calendar and Date. The String formats are described by ISODateTimeFormat.localTimeParser . The default String converter ignores the zone and only parses the field values.
Parameters:
  instant - the datetime object
Parameters:
  zone - the time zone
throws:
  IllegalArgumentException - if the instant is invalid




LocalTime
public LocalTime(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. Once the constructor is completed, the zone is no longer used.

The recognised object types are defined in org.joda.time.convert.ConverterManager ConverterManager and include ReadablePartial, ReadableInstant, String, Calendar and Date. The String formats are described by ISODateTimeFormat.localTimeParser . The default String converter ignores the zone and only parses the field values.
Parameters:
  instant - the datetime object
Parameters:
  chronology - the chronology
throws:
  IllegalArgumentException - if the instant is invalid




LocalTime
public LocalTime(int hourOfDay, int minuteOfHour)(Code)
Constructs an instance set to the specified time using ISOChronology.
Parameters:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour



LocalTime
public LocalTime(int hourOfDay, int minuteOfHour, int secondOfMinute)(Code)
Constructs an instance set to the specified time using ISOChronology.
Parameters:
  hourOfDay - the hour of the day
Parameters:
  minuteOfHour - the minute of the hour
Parameters:
  secondOfMinute - the second of the minute



LocalTime
public LocalTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)(Code)
Constructs an instance set to the specified time using ISOChronology.
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



LocalTime
public LocalTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, Chronology chronology)(Code)
Constructs an instance set to the specified time using the specified chronology, whose zone is ignored.

If the chronology is null, ISOChronology is used.
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
compareTo
public int compareTo(Object partial)(Code)
Compares this partial with another returning an integer indicating the order.

The fields are compared in order, from largest to smallest. The first field that is non-equal is used to determine the result.

The specified object must be a partial instance whose field types match those of this partial.

NOTE: This implementation violates the Comparable contract. This method will accept any instance of ReadablePartial as input. However, it is possible that some implementations of ReadablePartial exist that do not extend AbstractPartial, and thus will throw a ClassCastException if compared in the opposite direction. The cause of this problem is that ReadablePartial doesn't define the compareTo() method, however we can't change that until v2.0.
Parameters:
  partial - an object to check against negative if this is less, zero if equal, positive if greater
throws:
  ClassCastException - if the partial is the wrong classor if it has field types that don't match
throws:
  NullPointerException - if the partial is null




equals
public boolean equals(Object partial)(Code)
Compares this ReadablePartial with another returning true if the chronology, field types and values are equal.
Parameters:
  partial - an object to check against true if fields and values are equal



fromCalendarFields
public static LocalTime fromCalendarFields(Calendar calendar)(Code)
Constructs a LocalTime 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 LocalTime. This is useful if you have been using the Calendar as a local time, ignoing the zone.

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




fromDateFields
public static LocalTime fromDateFields(Date date)(Code)
Constructs a LocalTime 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 LocalTime. This is useful if you have been using the Date as a local time, ignoing the zone.

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




fromMillisOfDay
public static LocalTime fromMillisOfDay(long millisOfDay)(Code)
Constructs a LocalTime 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 LocalTime fromMillisOfDay(long millisOfDay, Chronology chrono)(Code)
Constructs a LocalTime 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




get
public int get(DateTimeFieldType fieldType)(Code)
Get the value of one of the fields of time.

This method gets the value of the specified field. For example:

 DateTime dt = new DateTime();
 int hourOfDay = dt.get(DateTimeFieldType.hourOfDay());
 

Parameters:
  fieldType - a field type, usually obtained from DateTimeFieldType, not null the value of that field
throws:
  IllegalArgumentException - if the field type is null



getChronology
public Chronology getChronology()(Code)
Gets the chronology of the time. the Chronology that the time is using



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




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



getLocalMillis
protected long getLocalMillis()(Code)
Gets the local milliseconds from the Java epoch of 1970-01-01T00:00:00 (not fixed to any specific time zone). the number of milliseconds since 1970-01-01T00:00:00
since:
   1.5 (previously private)



getMillisOfDay
public int getMillisOfDay()(Code)
Get the millis of day field value. the millis 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



getValue
public int getValue(int index)(Code)
Gets the value of the field at the specifed index.

This method is required to support the ReadablePartial interface. The supported fields are HourOfDay, MinuteOfHour, SecondOfMinute and MillisOfSecond.
Parameters:
  index - the index, zero to three the value
throws:
  IndexOutOfBoundsException - if the index is invalid




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



isSupported
public boolean isSupported(DateTimeFieldType type)(Code)
Checks if the field type specified is supported by this local time and chronology. This can be used to avoid exceptions in LocalTime.get(DateTimeFieldType) .
Parameters:
  type - a field type, usually obtained from DateTimeFieldType true if the field type is supported



isSupported
public boolean isSupported(DurationFieldType type)(Code)
Checks if the duration type specified is supported by this local time and chronology.
Parameters:
  type - a duration type, usually obtained from DurationFieldType true if the field type is supported



millisOfDay
public Property millisOfDay()(Code)
Get the millis of day property which provides access to advanced functionality. the millis 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 LocalTime minus(ReadablePeriod period)(Code)
Returns a copy of this time 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 LocalTime.minusHours(int) .
Parameters:
  period - the period to reduce this instant by a copy of this time with the period taken away
throws:
  ArithmeticException - if the result exceeds the internal capacity




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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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 LocalTime plus(ReadablePeriod period)(Code)
Returns a copy of this time 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 LocalTime.plusHours(int) .
Parameters:
  period - the period to add to this one, null means zero a copy of this time with the period added
throws:
  ArithmeticException - if the result exceeds the internal capacity




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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

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



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

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

The following three lines are identical in effect:

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

Parameters:
  seconds - the amount of seconds to add, may be negative the new LocalTime plus the increased seconds



property
public Property property(DateTimeFieldType fieldType)(Code)
Gets the property object for the specified type, which contains many useful methods.
Parameters:
  fieldType - the field type to get the chronology 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, which is four. The supported fields are HourOfDay, MinuteOfHour, SecondOfMinute and MillisOfSecond. the field count, four



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



toDateTimeToday
public DateTime toDateTimeToday(DateTimeZone zone)(Code)
Converts this LocalTime 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 time as a datetime using todays date




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



toString
public String toString(String pattern)(Code)
Output the time using the specified format pattern.
Parameters:
  pattern - the pattern specification, null means use toString
See Also:   org.joda.time.format.DateTimeFormat



toString
public String toString(String pattern, Locale locale) throws IllegalArgumentException(Code)
Output the time using the specified format pattern.
Parameters:
  pattern - the pattern specification, null means use toString
Parameters:
  locale - Locale to use, null means default
See Also:   org.joda.time.format.DateTimeFormat



withField
public LocalTime 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 hourOfDay then the hour of day field would be changed in the returned instance. If the field type is null, then this is returned.

These lines are equivalent:

 LocalTime updated = dt.withHourOfDay(6);
 LocalTime updated = dt.withField(DateTimeFieldType.hourOfDay(), 6);
 

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



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

If the addition is zero or the field is null, then this is returned.

If the addition causes the maximum value of the field to be exceeded, then the value will wrap. Thus 23:59 plus two minutes yields 00:01.

These lines are equivalent:

 LocalTime added = dt.plusHours(6);
 LocalTime added = dt.withFieldAdded(DurationFieldType.hours(), 6);
 

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



withFields
public LocalTime withFields(ReadablePartial partial)(Code)
Returns a copy of this time with the partial set of fields replacing those from this instance.

For example, if the partial contains an hour and minute then those two fields will be changed in the returned instance. Unsupported fields are ignored. If the partial is null, then this is returned.
Parameters:
  partial - the partial set of fields to apply to this time, null ignored a copy of this time with a different set of fields
throws:
  IllegalArgumentException - if any value is invalid




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

LocalTime 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




withLocalMillis
LocalTime withLocalMillis(long newMillis)(Code)
Returns a copy of this time with different local millis.

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




withMillisOfDay
public LocalTime withMillisOfDay(int millis)(Code)
Returns a copy of this time with the millis of day field updated.

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




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

LocalTime 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




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

LocalTime 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




withPeriodAdded
public LocalTime withPeriodAdded(ReadablePeriod period, int scalar)(Code)
Returns a copy of this time 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 LocalTime.withFieldAdded(DurationFieldType,int) or LocalTime.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 time with the period added
throws:
  ArithmeticException - if the result exceeds the internal capacity




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

LocalTime 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




Methods inherited from org.joda.time.base.BaseLocal
abstract protected long getLocalMillis()(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.