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,
})
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_timeInputs
| Field | InventScript name | Value |
|---|---|---|
| Unix Time | unix_time | e.g. "1700000000" |
| Period | period | "year", "month", "week", "day", "hour", "minute", "second" |
Outputs
| Field | InventScript name | Value |
|---|---|---|
| Truncated Time (Unix) | truncated_time_unix | e.g. "1700000000" |
Example InventScript
More time blocks
Get Current Date and TimeGet the current UTC date and time in various formats.Parse Unix TimeParse a Unix timestamp into a human-readable date and time.Get Snowflake TimestampConvert a Discord snowflake ID into a creation date and time.Sleep / WaitPause the flow for a specified duration.Parse Relative TimeParse a user-provided relative time string into a Unix timestamp.Modify TimeAdd or subtract time from a Unix timestamp.Get Specific TimeGet a specific time in the future or past in a variety of formats.Parse Month NameParse a month name into a number.Parse Date and TimeParse a date and time into a Unix timestamp with a variety of parsing options.Standard Format Date and TimeFormat a Unix timestamp into a standardized date and time string.Generate TimecodeGenerate a Discord timestamp timecode from a Unix time.