Truncate Time

BlockTime

Truncate a Unix timestamp to a given period.

Inputs

Unix TimeRequired

Unix timestamp to truncate.

Example: 1700000000

PeriodRequired

Period to truncate to.

Optionsyearmonthweekdayhourminutesecond

Outputs

Truncated Time (Unix)

Truncated time in Unix seconds.

Example: 1700000000

Build a bot using blocks like Truncate 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: truncate_time

Inputs

FieldInventScript nameValue
Unix Timeunix_timee.g. "1700000000"
Periodperiod"year", "month", "week", "day", "hour", "minute", "second"

Outputs

FieldInventScript nameValue
Truncated Time (Unix)truncated_time_unixe.g. "1700000000"

Example InventScript

truncateTime := truncate_time(Args{unix_time: "1700000000", period: "hour"})
send_text_message(Args{
	channel_id:      trigger.channel_id,
	message_content: "Truncated Time (Unix): " + truncateTime.truncated_time_unix,
})

More time blocks