Parse Date and Time

BlockTime

Parse a date and time into a Unix timestamp with a variety of parsing options.

If both date and time are requested, they must be provided in the order of date then time, and be separated by a space.

Inputs

Input DateTimeRequired

User-provided date and/or time to parse.

Example: 12/10/2025 15:04

Date FormatRequired

Expected date format.

OptionsMM/DD/YYYYDD/MM/YYYYYYYY/MM/DD
Time FormatRequired

Expected time format.

OptionsHH:MM:SSHH:MMHH:MM:SS AM/PMHH:MM AM/PM
Standardized Format

If set, the date/time format will be ignored and the standardized format will be used.

OptionsRFC 3339ANSICUnix DateRuby DateRFC 822RFC 822ZRFC 850RFC 1123RFC 1123ZRFC 3339Nano

Outputs

Parsed Time (Unix)

Parsed time in Unix seconds.

Example: 1700000000

Build a bot using blocks like Parse Date and Time

Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.

Advanced Documentation

This documentation can be useful when using code mode. View as Markdown

ID: parse_datetime

Inputs

FieldInventScript nameValue
Input DateTimeinput_datetimee.g. "12/10/2025 15:04"
Date Formatdate_format"MM/DD/YYYY", "DD/MM/YYYY", "YYYY/MM/DD"
Time Formattime_format"HH:MM:SS", "HH:MM", "HH:MM:SS AM/PM", "HH:MM AM/PM"
Standardized Formatstandardized_format"RFC 3339", "ANSIC", "Unix Date", "Ruby Date", "RFC 822", "RFC 822Z", "RFC 850", "RFC 1123", "RFC 1123Z", "RFC 3339Nano"

Outputs

FieldInventScript nameValue
Parsed Time (Unix)parsed_time_unixe.g. "1700000000"

Example InventScript

parseDatetime := parse_datetime(Args{
	input_datetime: "12/10/2025 15:04",
	date_format:    "MM/DD/YYYY",
	time_format:    "HH:MM",
})
send_text_message(Args{
	channel_id:      trigger.channel_id,
	message_content: "Parsed Time (Unix): " + parseDatetime.parsed_time_unix,
})

More time blocks