Using DURATION to read time

Hi all,

Has any one used DURATION to read out a block of time?

I have a list of Time (minutes:seconds.milliseconds) or (2:04.09)
so this should be read “2 mins 4 seconds and 9 milliseconds”

I’m currently using the TIME option, but Alexa reads it as (2 colon 04 dot 09) which definitely doesn’t sound right.

I’m using Airtable and I have a lot of rows with Time (total time to complete a race)


As the interpret-as time tag can not deal with milliseconds, you can write a code in a Code block to generate the text for Alexa.

var myTime = "2:04.09";

var minutes = parseInt(myTime.split(":")[0]);
var seconds = parseInt(myTime.split(':').pop().split('.')[0]);
var milliseconds = parseInt(myTime.split(".")[1]);

myVar = minutes+((minutes <2) ? ' minute, ' : ' minutes, ') + seconds + ((seconds <2) ? ' second and ' : ' seconds and ') + milliseconds + ((milliseconds <2) ? ' millisecond' : ' milliseconds');

In this example, you’ll have “2 minutes, 4 seconds and 9 milliseconds” as a result in your variable myVar.

1 Like

Thanks Nicolas,

I just did a search and replace and added the word “milliseconds” at the end of the times.
That seem to have worked, but I do like you suggestion.
Maybe Voiceflow will add that to the platform. :slight_smile:

1 Like