Secret Timespan Shortcuts

by Jul 13, 2010

Usually, to create time spans, you will use New-Timespan. However, you can also use a more developer-centric approach by converting a number to a time span type:


This will get you a time span of 100 ticks, which is the smallest unit available to measure time. As PowerShell does support some hidden shortcuts for other units, this will create a time span of exactly five days:


Twitter This Tip! ReTweet this Tip!