Author Posts

August 31, 2017 at 11:40 pm

Sorry about the off topic but can anyone advise how I could convert (with powershell!) this Convergence Time value for AD repl?



September 1, 2017 at 4:15 am

Hi Jeff, it would help if you explain how you got this time value and what the parts represent. Taking a wild guess I'm thinking 13 minutes, 14 seconds, 1445641 10 millionths of a second. I assume you mean convert it into a timespan, but you really did not say what you wanted to convert it into.

You could do something like this.

$timestamp = "PT13M14.1445641S"
(Select-String -InputObject $timestamp -Pattern "^(\d*?)PT(\d*?)M(\d*?)\.(\d*?)S$").Matches |
ForEach-Object {
    [System.TimeSpan]::FromMinutes($_.Groups[2].value) +
    [System.TimeSpan]::FromSeconds($_.Groups[3].value) +