# LocalTime

## `LocalTime` Class

The `LocalTime` class represents a time of day without a date and time zone. It provides methods for creating, manipulating, and comparing time values.

```typescript
var localtime = LocalTime.of(15, 30); // LTIME 15:30
```

### Static Methods

#### `now()`

* Returns the current time.
* Example Usage:

  ```java
  var currentTime = LocalTime.now();
  ```

#### `parse(text: String)`

* Parses the input text to create a `LocalTime` instance.
* Example Usage:

  ```java
  var parsedTime = LocalTime.parse("15:30:45");
  ```

#### `of(hour: Integer, minute: Integer, second: Integer)`

* Creates a `LocalTime` instance with the specified hour, minute, and second values.
* Example Usage:

  ```java
  var customTime = LocalTime.of(15, 30, 45);
  ```

#### `of(hour: Integer, minute: Integer, second: Integer, nanoOfSecond: Integer)`

* Creates a `LocalTime` instance with the specified hour, minute, second, and nanosecond values.
* Example Usage:

  ```java
  var customTimeWithNano = LocalTime.of(15, 30, 45, 500000000);
  ```

***

### Getter Methods

#### `getHour()`

* Gets the hour-of-day field.
* Returns the hour-of-day, from 0 to 23.
* Example Usage:

  ```java
  var hour = customTime.getHour();
  ```

#### `getMinute()`

* Gets the minute-of-hour field.
* Returns the minute-of-hour, from 0 to 59.
* Example Usage:

  ```java
  var minute = customTime.getMinute();
  ```

#### `getSecond()`

* Gets the second-of-minute field.
* Returns the second-of-minute, from 0 to 59.
* Example Usage:

  ```java
  var second = customTime.getSecond();
  ```

#### `getNano()`

* Gets the nano-of-second field.
* Returns the nano-of-second, from 0 to 999,999,999.
* Example Usage:

  ```java
  var nano = customTime.getNano();
  ```

***

### Time Manipulation Methods

#### `plusHours(hoursToAdd: Long)`

* Adds the specified number of hours to the current time and returns a new `LocalTime` instance.
* Example Usage:

  ```java
  var newTime = customTime.plusHours(2);
  ```

#### `plusMinutes(minutesToAdd: Long)`

* Adds the specified number of minutes to the current time and returns a new `LocalTime` instance.
* Example Usage:

  ```java
  var newTime = customTime.plusMinutes(30);
  ```

#### `plusSeconds(secondsToAdd: Long)`

* Adds the specified number of seconds to the current time and returns a new `LocalTime` instance.
* Example Usage:

  <pre class="language-java"><code class="lang-java"><strong>var newTime = customTime.plusSeconds(15);
  </strong></code></pre>

#### `plusNanos(nanosToAdd: Long)`

* Adds the specified number of nanoseconds to the current time and returns a new `LocalTime` instance.
* Example Usage:

  ```java
  var newTime = customTime.plusNanos(500000000);
  ```

#### `minusHours(hoursToSubtract: Long)`

* Subtracts the specified number of hours from the current time and returns a new `LocalTime` instance.
* Example Usage:

  ```java
  var newTime = customTime.minusHours(1);
  ```

#### `minusMinutes(minutesToSubtract: Long)`

* Subtracts the specified number of minutes from the current time and returns a new `LocalTime` instance.
* Example Usage:

  ```java
  var newTime = customTime.minusMinutes(10);
  ```

#### `minusSeconds(secondsToSubtract: Long)`

* Subtracts the specified number of seconds from the current time and returns a new `LocalTime` instance.
* Example Usage:

  ```java
  var newTime = customTime.minusSeconds(30);
  ```

#### `minusNanos(nanosToSubtract: Long)`

* Subtracts the specified number of nanoseconds from the current time and returns a new `LocalTime` instance.
* Example Usage:

  ```java
  var newTime = customTime.minusNanos(100000000);
  ```

***

### Comparison Methods

#### `isBefore(otherInstant: LocalTime)`

* Checks if the current time is before the specified `LocalTime` instance.
* Returns `true` if the current time is before `otherInstant`, `false` otherwise.
* Example Usage:

  ```java
  var before = customTime.isBefore(parsedTime);
  ```

#### `isAfter(otherInstant: LocalTime)`

* Checks if the current time is after the specified `LocalTime` instance.
* Returns `true` if the current time is after `otherInstant`, `false` otherwise.
* Example Usage:

  ```java
  var after = customTime.isAfter(parsedTime);
  ```

***

### Conversion Method

#### `toString()`

* Converts the `LocalTime` to a string representation in the format "HH:mm:ss".
* Example Usage:

  ```java
  var timeString = customTime.toString();
  ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.b2winsuite.com/5.6/scripting/types-and-objects/objects/localtime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
