B2Win Suite Documentation (Under Construction)
5.4
5.4
  • B2Win Suite Documentation
  • Scripting
    • B2Win Suite Scripting Overview
    • Scripting in B2Data
      • Custom Script Nodes
        • Custom Script
        • Source Script Node (File)
        • Source Script Node (Table)
        • Source Script Node (Object)
        • If-Else Condition
        • Condition Node
      • In DataPrep
      • Properties
      • Workflow Applications
        • Workflow #1
        • Workflow #2
    • Getting Started
    • Language Basics
    • Types & Objects
      • Primitives
      • Objects
        • Instant
        • LocalDateTime
        • LocalDate
        • LocalTime
        • JsonNode
        • ObjectNode
        • File
        • SuiteTable
        • Duration
      • Arrays & Maps
      • Row, Column, StringColumn
    • Utilities
      • Date & Time
        • InstantUtil
        • GeneralDateUtil
        • LocalDateTimeUtil
        • LocalDateUtil
        • LocalTimeUtil
        • Formatting
        • Timezones
      • Math
      • StrictMath
      • NumericUtil
      • DbUtil
      • DbExecutor
      • StateUtil
      • FileUtil
      • JsonUtil
      • HttpUtil
      • NodeInputReader
      • RandomUtil
      • HashingUtil
      • CompressionUtil
      • Logging
    • Properties
    • Context and System
      • Context
      • System
    • Configurations
      • Workflow Configuration
    • Tutorial
    • Feedback
  • B2Data
    • Workflow Settings
      • General Settings
      • Global/All Properties
      • Execution Configuration
        • General
        • Runtime
        • Compiler
        • Storage
        • Clean Up
      • Permissions
    • Nodes
      • Scheduler
    • Services Configuration
      • Power BI
Powered by GitBook
On this page
  • LocalTime Class
  • Static Methods
  • Getter Methods
  • Time Manipulation Methods
  • Comparison Methods
  • Conversion Method
  1. Scripting
  2. Types & Objects
  3. Objects

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.

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

Static Methods

now()

  • Returns the current time.

  • Example Usage:

    var currentTime = LocalTime.now();

parse(text: String)

  • Parses the input text to create a LocalTime instance.

  • Example Usage:

    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:

    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:

    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:

    var hour = customTime.getHour();

getMinute()

  • Gets the minute-of-hour field.

  • Returns the minute-of-hour, from 0 to 59.

  • Example Usage:

    var minute = customTime.getMinute();

getSecond()

  • Gets the second-of-minute field.

  • Returns the second-of-minute, from 0 to 59.

  • Example Usage:

    var second = customTime.getSecond();

getNano()

  • Gets the nano-of-second field.

  • Returns the nano-of-second, from 0 to 999,999,999.

  • Example Usage:

    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:

    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:

    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:

    var newTime = customTime.plusSeconds(15);

plusNanos(nanosToAdd: Long)

  • Adds the specified number of nanoseconds to the current time and returns a new LocalTime instance.

  • Example Usage:

    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:

    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:

    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:

    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:

    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:

    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:

    var after = customTime.isAfter(parsedTime);

Conversion Method

toString()

  • Converts the LocalTime to a string representation in the format "HH:mm:ss".

  • Example Usage:

    var timeString = customTime.toString();
PreviousLocalDateNextJsonNode

Last updated 1 year ago