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
  1. Scripting
  2. Utilities
  3. Date & Time

LocalDateUtil

LocalDateUtil provides utility methods for working with LocalDate objects. It includes methods for parsing, and extracting various date components.

Methods

parseDate(dateStr: String, format: String): LocalDate

  • Parses a date string using a custom format and returns a LocalDate object.

  • Parameters:

    • dateStr (type: String) - The date string to parse.

    • format (type: String) - The custom date format pattern used for parsing.

  • Returns:

    • A LocalDate object representing the parsed date.

var dateStr = "2023-11-07";
var format = "yyyy-MM-dd";
var parsedDate = LocalDateUtil.parseDate(dateStr, format);

getYear(date: LocalDateTime): Integer

  • Retrieves the year component of a LocalDateTime object.

  • Parameters:

    • date (type: LocalDateTime) - The LocalDateTime object from which to extract the year.

  • Returns:

    • An integer representing the year component.

var dateTime = LocalDateTime.now();
var year = LocalDateUtil.getYear(dateTime);

getDayOfYear(date: LocalDate): Integer

  • Retrieves the day of the year component of a LocalDate object.

  • Parameters:

    • date (type: LocalDate) - The LocalDate object from which to extract the day of the year.

  • Returns:

    • An integer representing the day of the year.

var date = LocalDate.now();
var dayOfYear = LocalDateUtil.getDayOfYear(date);

getMonthName(date: LocalDate): String

  • Retrieves the name of the month for a LocalDate object.

  • Parameters:

    • date (type: LocalDate) - The LocalDate object from which to extract the month name.

  • Returns:

    • A string representing the name of the month.

var date = LocalDate.now();
var monthName = LocalDateUtil.getMonthName(date);

getMonth(date: LocalDate): Integer

  • Retrieves the month component of a LocalDate object.

  • Parameters:

    • date (type: LocalDate) - The LocalDate object from which to extract the month.

  • Returns:

    • An integer representing the month.

var date = LocalDate.now();
var month = LocalDateUtil.getMonth(date);

getDayOfWeek(date: LocalDate): String

  • Retrieves the day of the week for a LocalDate object.

  • Parameters:

    • date (type: LocalDate) - The LocalDate object from which to extract the day of the week.

  • Returns:

    • A string representing the day of the week.

var customDate = LocalDate.of(2023, 10, 24);
return LocalDateUtil.getDayOfWeek(customDate); // TUESDAY

getDayOfMonth(date: LocalDate): Integer

  • Retrieves the day of the month component of a LocalDate object.

  • Parameters:

    • date (type: LocalDate) - The LocalDate object from which to extract the day of the month.

  • Returns:

    • An integer representing the day of the month.

var date = LocalDate.now();
var dayOfMonth = LocalDateUtil.getDayOfMonth(date);

These methods provide various operations to work with LocalDate objects, including parsing date strings, and extracting individual date components.

PreviousLocalDateTimeUtilNextLocalTimeUtil

Last updated 1 year ago