You can use azure CLI or rest apis to get the duration.
Sample Azure cli command
az deployment list --query '[].[ name, properties.duration ]'
This will list the deployment name and the duration. The duration is a string in a specific format.
For example,
- PT1M38.9192782S for 1 minute and 38 seconds.
- PT16.0054451S for 16 seconds.
Reference for the rest api is here