I'm trying to make a military time converter using Slack Workflows. It works by pulling up a form when they press the button in the channel.
It asks them one question.
What is the time in military time? (Format XX:XX)
Value then imports itself into a Google Sheet and uses a different cell formatted for standard time.
The workflow system then reads the value of the two cells and puts them together into a text string.
Due to the limited nature of Slack Workflows. I cannot simply restrict their inputs to only match my formatting, so people are putting in things like.
1314
or 13
, rather than 13:14
or 13:00
. The issue is that the cellular input no longer reads as a time in the Google Sheet, meaning I'm getting returns like this.
1314 is 12:00 am in standard time.
To solve this, I used the REPLACE function in Google Sheets to add missing values.
=REPLACE(B3,3,0,":")
Or
=REPLACE(B3,3,0,":00")
Which works fine if they're entering the text in the incorrect format.
But if they enter the text in the format that the tool tells them to, the system then errors out and gives the following return.
13::00 is 12:00 am in standard time.
I tried or search function to only fire the replace function if it's not formatted correctly but has been unsuccessful thus far, getting errors like #Value
, #Error
, etc.
Before anybody asks, unfortunately, I cannot make a Slack application due to security restrictions, and I cannot access sheets/excel for similar reasons.