Michael Risby Posted May 24 Share Posted May 24 Hello, We have a business process which posts to a slack channel using ibrige automation, the message posted is below:Logged Development Release - &[global["inputParams"]["requestId"]] - &[global["flowcoderefs"]["getReqInformation"]["summary"]] at &[global["flowcoderefs"]["getReqInformation"]["scheduledStartDate"]] So this takes the variables "scheduledStartDate" and posts to slack, but this is showing as UTC :Logged Development Release - RM00114913 - end to end - test 1 at 2022-05-24 08:00:00Z Converted date time: I understand the DB stores date times as UTC and scheduledStartDate will be outputting the raw value rather than converting to the regional time zone set. The documentation for wiki markup did not resolve this issue. How can i format the date time to local time zone in a slack message? Link to comment Share on other sites More sharing options...
Victor Posted May 24 Share Posted May 24 9 minutes ago, Michael Risby said: How can i format the date time to local time zone in a slack message? @Michael Risby isn't this actually a question for Slack? It would make sense for Slack to also store dates in UTC and have the date formatted in the UI based on user or machine regional setting. With this in mind it also makes sense for the date to arrive in Slack in UTC and then have Slack format it in the UI... no idea how Slack does and where when it comes to dates. Link to comment Share on other sites More sharing options...
Michael Risby Posted May 24 Author Share Posted May 24 Slack can do when provided with a unix timestamp (which from digging im not sure hornbill can provide) so i was hoping there would be a variable that outputs converted to local time zone, like email templates do Mike Link to comment Share on other sites More sharing options...
Victor Posted May 24 Share Posted May 24 @Michael Risby the email template does format the date but, as you said is an output. Still won't recommend sending a date value formatted to a time zone in a different system. The risk is that the other system will take that vale and consider it as UTC... We don't have any dedicated utility to get the Unix timestamp. But given that the Unix timestamp is basically the number of seconds since Jan 1970, the below "date difference" utility could be used to get that number. The difference is (also) outputted in seconds and that would be what you are after... Link to comment Share on other sites More sharing options...
Michael Risby Posted May 24 Author Share Posted May 24 sounds like a cool solution, having a bit of trouble getting it working though Feel like it may be exceeding some field sizes, outputs from the date difference to 1970: &[global["UtilitiesGetDateDifference"]["days"]] - 19136 &[global["UtilitiesGetDateDifference"]["hours"]] - 9 &[global["UtilitiesGetDateDifference"]["minutes"]] - 0 &[global["UtilitiesGetDateDifference"]["seconds"]] - 0 Or am i just using it wrong? Link to comment Share on other sites More sharing options...
Victor Posted May 24 Share Posted May 24 (edited) @Michael Risby ermm... right, no, not using it wrong. I misread how the values are outputted ... it will return "days AND hours AND minutes AND seconds" as opposed to "days OR hours OR minutes OR seconds" ... I'll ask devs if they can add an output for the UNIX timestamp on this node: Meanwhile you can use the same node to format the date in reginal timezone. Not recommended as a solution given the maintenance overhead with shifting timezones (e.g. BST) Edited May 24 by Victor Workaround no longer needed as a permanent solution was deployed Link to comment Share on other sites More sharing options...
Victor Posted May 24 Share Posted May 24 @Michael Risby the "GetTimestamp" operation has now been enhanced to also return the UNIX stamp. This is now available in all customer instances. Link to comment Share on other sites More sharing options...
Michael Risby Posted May 25 Author Share Posted May 25 Brilliant thanks Victor! will have a go with this 1 Link to comment Share on other sites More sharing options...
Michael Risby Posted May 25 Author Share Posted May 25 This worked a treat, for anyone searching for this, slack message in hornbill would look like: <!date^&[global["UtilitiesGetTimestamp"]["timestampUnixS"]]^{date} at {time}|&[global["flowcoderefs"]["getReqInformation"]["scheduledStartDate"]]> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now