Convert ISO 8601 time to human readable with mustache syntax

I’ve got a PowerShell table that retrieves Teams User activity from Microsoft Graph, and some of the results are durations in ISO 8601 format. Can I use mustache syntax to convert that to human readable format, and if so, how?

I would do it in the PowerShell script instead as you’re already with a strong scripting language. Thus, I would change your Select-Object from

$object | Select-Object name,duration,...


$object | Select-Object name,@{n='formattedDuration';e={[(date]($_.duration)).toString()}},...

However, my understanding of the mustache is that you can use JavaScript functions inside it. So you should find the JS method (I found this one quickly but no idea if working or not) to format as you wish. So if I’m right it should be something like

{{(new date duration).toString()}}

Of course, disclaimer that all the above are pseudo codes. Modify and play around :slight_smile:

Good Luck

Thanks Pascal, I did end up doing it in PowerShell in the end

1 Like