Search code examples
slackslack-api

Slack: Can <!date^...> send current date/time?


In Slack, when using date formatting, such as <!date^1392734382^{date_num}|fallback text>, is it possible to send the current date/time instead of providing a specific Unix time?


Solution

  • No. This function is just for formatting. So you need to provide timestamp.

    But most programming languages have a standard function that returns the current UTC time as UNIX epoch, which you can use.

    For example in Python you would do:

    from time import time
    
    timestamp = int(time())