ParseDateTime

Parses a date/time string into a timestamp.

Syntax

ParseDateTime(value: string): number

Parameters

  • value: A string representing the date/time to parse

Return Value

Returns a number representing the Unix timestamp (seconds since epoch).

Description

The ParseDateTime method converts a date/time string into a Unix timestamp. It supports multiple input formats:

  1. Full date and time: "YYYY.MM.DD HH:MM"

  2. Date only: "YYYY.MM.DD"

  3. Time only: "HH:MM"

When only time is provided, the current date is used.

Supported Formats

  1. Full DateTime Format:

    • Pattern: "YYYY.MM.DD HH:MM"

    • Example: "2024.02.12 14:30"

  2. Date Only Format:

    • Pattern: "YYYY.MM.DD"

    • Example: "2024.02.12"

  3. Time Only Format:

    • Pattern: "HH:MM"

    • Example: "14:30"

Example

Last updated