What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
For a fixed, readable duration such as 2.04:07:09, call $span.ToString('d.hh:mm:ss'). For wording such as 2 days, 4 hours, 7 minutes, use a small formatter function: PowerShell has no general built-in cmdlet that turns a [TimeSpan] into natural language. Keep the value as a [TimeSpan] while calculating, and format it only when you display or export it.
Create or obtain a TimeSpan
A [TimeSpan] represents an interval or duration, not a calendar date. You can create one directly with New-TimeSpan:
$span = New-TimeSpan -Days 2 -Hours 4 -Minutes 7 -Seconds 9
Or subtract two dates. This example measures the time since three hours ago:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute$start = (Get-Date).AddHours(-3)
$span = (Get-Date) - $start
New-TimeSpan also accepts start and end dates. For a file’s age, its -Start parameter has a LastWriteTime alias, so you can pipe a file into it:
#1 Best Overall
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
Get-Item C:Logsapp.log | New-TimeSpan
See Microsoft’s New-TimeSpan documentation for its parameter sets and behavior.
Choose the right properties
TimeSpan component properties describe the pieces of a duration. Aggregate properties express the whole duration in one unit:
$span.Days # 2
$span.Hours # 4
$span.TotalDays # 2.171...
$span.TotalHours # 52.12...
For a duration of 52 hours, .Days is 2 and .Hours is 4: the latter is the hour component remaining after whole days. .TotalHours is 52. Use component properties to build compound text such as “2 days, 4 hours”; use TotalDays, TotalHours, TotalMinutes, TotalSeconds, or TotalMilliseconds when you need the entire duration as one unit, such as when comparing it to a threshold.
if ($span.TotalMinutes -gt 30) {
'Long-running operation'
}
Fixed and technical formats
For technical output, .NET provides standard formats. The constant format is stable and useful for diagnostics or interchange when the receiving system expects a .NET TimeSpan string:
Rank #2
- Pair and Play: With fast, easy Bluetooth wireless technology, you’re connected in seconds to this quiet cordless mouse —no dongle or port required
- Less Noise, More Focus: Silent mouse with 90% reduced click sound and the same click feel, eliminating noise and distractions for you and others around you (1)
- Long-Lasting Battery Life: Up to 18-month battery life with an energy-efficient auto sleep feature, so you can go longer between battery changes (2)
- Comfortable, Travel-Friendly Design: Small enough to toss in a bag; this slim and ambidextrous portable compact mouse guides either your right or left hand into a natural position
- Long-Range: Reliable, long-range Bluetooth wireless mouse works up to 10m/33 feet away from your computer (3)
$span.ToString('c')
The other standard forms, g and G, are general short and general long formats:
$span.ToString('g')
$span.ToString('G')
For a specific layout, use a custom format:
$span.ToString('d.hh:mm:ss')
# 2.04:07:09
Here, d is the whole-day component and hh is the remaining hour component, not total hours. Use dd to pad the day component to two digits. Separators such as periods and colons must be escaped or quoted in a custom TimeSpan format:
$span.ToString('dd.hh:mm:ss')
$span.ToString('d.hh:mm:ss.fff')
The second example adds three fixed fractional-second digits. Custom formats do not automatically add a sign for negative values, so handle that separately if negative durations are possible. For token details, see Microsoft’s custom TimeSpan format strings and standard TimeSpan format strings references.
Recommended Free Tools
You can also use PowerShell’s composite formatting operator, -f:
Rank #3
- 【Dual Mode Wireless Bluetooth Mouse】: Switch easily between two devices—connect one via Bluetooth (BT5.2/3.0) and the other using a 2.4G USB receiver. No drivers needed; just plug and play. Enjoy a reliable connection up to 33 feet. Note: You can't use both modes simultaneously; the USB receiver is stored in the mouse.
- 【Rechargeable Wireless Mouse】: Equipped with a 500mAh lithium-ion battery, it charges in 2 hours for over 7 days of use and 30 days on standby. The mouse sleeps after 5 minutes of inactivity to save power and can be woken with any click.
- 【Colorful LED Breathing Light】: Features 7 colorful LED lights that change randomly, adding a fun atmosphere to your workspace.
- 【Portable Mouse】Compact size (4.4 x 2.3 x 1.1 inches) makes it easy to fit in your laptop bag. Lightweight and ergonomic, it's perfect for travel. Contact us anytime for support.
- 【Wide Compatibility】: Works with laptops, PCs, tablets, and smartphones across various operating systems, including Android, Windows, and Mac. Ideal for home, office, and travel.
'{0:d.hh:mm:ss}' -f $span
For a one-off display, simple interpolation is possible, but it always prints every unit and does not pluralize or handle negatives neatly:
'{0} days, {1} hours, {2} minutes' -f $span.Days, $span.Hours, $span.Minutes
Build a natural-language formatter
The following function works with Windows PowerShell 5.1 syntax and accepts spans through the pipeline. It omits zero components, pluralizes labels, reports zero as “0 seconds,” and prefixes negative durations with a minus sign. It shows milliseconds only when the span is less than one second; ordinary compound output otherwise stops at seconds.
function Format-FriendlyTimeSpan {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[TimeSpan] $TimeSpan
)
process {
$isNegative = $TimeSpan -lt [TimeSpan]::Zero
# Negate() overflows for TimeSpan.MinValue; reject that exceptional input.
if ($TimeSpan.Ticks -eq [TimeSpan]::MinValue.Ticks) {
throw 'TimeSpan.MinValue cannot be formatted by this function.'
}
$value = if ($isNegative) { $TimeSpan.Negate() } else { $TimeSpan }
$parts = New-Object 'System.Collections.Generic.List[string]'
foreach ($unit in @(
@{ Name = 'day'; Value = $value.Days }
@{ Name = 'hour'; Value = $value.Hours }
@{ Name = 'minute'; Value = $value.Minutes }
@{ Name = 'second'; Value = $value.Seconds }
)) {
if ($unit.Value -ne 0) {
$label = if ($unit.Value -eq 1) { $unit.Name } else { $unit.Name + 's' }
$parts.Add(('{0} {1}' -f $unit.Value, $label))
}
}
if ($parts.Count -eq 0 -and $value.Ticks -ne 0) {
$milliseconds = $value.Milliseconds
$label = if ($milliseconds -eq 1) { 'millisecond' } else { 'milliseconds' }
$parts.Add(('{0} {1}' -f $milliseconds, $label))
}
if ($parts.Count -eq 0) {
'0 seconds'
}
else {
$prefix = if ($isNegative) { '-' } else { '' }
$prefix + ($parts -join ', ')
}
}
}
Use it directly or pipe a measured interval into it:
Format-FriendlyTimeSpan (New-TimeSpan -Days 2 -Hours 4 -Minutes 7)
# 2 days, 4 hours, 7 minutes
$start = Get-Date
Start-Sleep -Seconds 3
$elapsed = (Get-Date) - $start
$elapsed | Format-FriendlyTimeSpan
This formatter is intentionally English-only. For scripts used across locales, make unit labels configurable or load localized resources; do not use localized display text as a machine-to-machine format.
Rank #4
- Your hand can relax in comfort hour after hour with this ergonomically designed mouse. Its contoured shape with soft rubber grips, gently curved sides and broad palm area give you the support you need for effortless control all day long.
- You’ve got the control to do more, faster. Flipping through photo albums and Web pages is a breeze, especially for right-handers—with three standard buttons plus Back/Forward buttons that you can also program to switch applications, go full screen and more. And side-to-side scrolling plus zoom gives you the power to scroll horizontally and vertically through your music library, maps and Facebook feeds, and zoom in and out of photos and budget spreadsheets with a click.* * Requires Logitech SetPoint software (Windows) or Logitech Control Center software (Mac OS X)
- Two years of battery life practically eliminates the need to replace batteries. ** The On/Off switch helps conserve power, smart sleep mode extends battery life and an indicator light eliminates surprises. ** Battery life may vary based on user and computing conditions.
- The tiny Logitech Unifying receiver stays in your laptop. There’s no need to unplug it when you move around, so there’s less worry of it being lost. And you can easily add compatible wireless mice and keyboards to the same wireless receiver.
Pick a display policy
“Friendly” depends on where the value appears. Choose how much detail the reader needs:
| Policy | Example | Good fit |
|---|---|---|
| Full compound | 2 days, 4 hours, 7 minutes, 9 seconds | Diagnostic reports where detail matters |
| Largest two units | 2 days, 4 hours | General-purpose status text |
| Largest unit only | 2 days | Compact dashboards or table columns |
| Small durations | 37 seconds; 450 milliseconds | Short tasks or performance diagnostics |
| Fixed technical | 2.04:07:09 | Consistent logs or technical reports |
For largest-unit-only output, select the unit using Total* properties. This example truncates rather than rounds, so it will not claim the next unit has elapsed:
function Format-ShortTimeSpan {
param([Parameter(Mandatory = $true)][TimeSpan] $TimeSpan)
$negative = $TimeSpan -lt [TimeSpan]::Zero
if ($TimeSpan.Ticks -eq [TimeSpan]::MinValue.Ticks) {
throw 'TimeSpan.MinValue cannot be formatted by this function.'
}
$value = if ($negative) { $TimeSpan.Negate() } else { $TimeSpan }
if ($value.TotalDays -ge 1) {
$number = [math]::Floor($value.TotalDays)
$unit = if ($number -eq 1) { 'day' } else { 'days' }
}
elseif ($value.TotalHours -ge 1) {
$number = [math]::Floor($value.TotalHours)
$unit = if ($number -eq 1) { 'hour' } else { 'hours' }
}
elseif ($value.TotalMinutes -ge 1) {
$number = [math]::Floor($value.TotalMinutes)
$unit = if ($number -eq 1) { 'minute' } else { 'minutes' }
}
elseif ($value.TotalSeconds -ge 1) {
$number = [math]::Floor($value.TotalSeconds)
$unit = if ($number -eq 1) { 'second' } else { 'seconds' }
}
else {
$number = [math]::Floor($value.TotalMilliseconds)
$unit = if ($number -eq 1) { 'millisecond' } else { 'milliseconds' }
}
$prefix = if ($negative) { '-' } else { '' }
'{0}{1} {2}' -f $prefix, $number, $unit
}
Use rounding only if the display should be an approximation. For example, [math]::Round($span.TotalMinutes) can round to the nearest minute; truncating with Floor avoids overstating elapsed time.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use formatted durations in reports without losing the object
Keep a TimeSpan or numeric value available for filtering, calculations, and exports. Format it at the final presentation step. PowerShell’s Format-Table and related formatting commands are for display, not data transformation; applying them early produces formatting records rather than the original objects. Microsoft explains this distinction in its formatting guidance.
Best Value
- 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
- 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
- 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
- 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
- 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.
For example, add a friendly uptime column to a process report while handling access failures when reading a protected process’s StartTime:
Get-Process | Select-Object Name, @{Name = 'Uptime'; Expression = {
try {
Format-FriendlyTimeSpan ((Get-Date) - $_.StartTime)
}
catch {
'Unavailable'
}
}}
The catch covers processes whose start time cannot be read in the current security context. For data you will filter, export, or pass to another command, retain the original duration in a separate property and add a string only for display.
Common mistakes and compatibility notes
- Using
Hoursfor total hours: a 52-hour duration has.Hoursequal to 4; use.TotalHourswhen you mean 52. - Forgetting separator escapes: a custom TimeSpan format needs literal punctuation escaped or quoted, as in
d.hh:mm:ss. - Dropping zero: a formatter that omits empty components should still return an explicit zero such as “0 seconds.”
- Ignoring negative intervals: preserve the sign rather than silently showing a negative duration as positive. The sample formatter rejects
TimeSpan.MinValue, whose absolute value cannot be represented as a TimeSpan. - Displaying meaningless precision: milliseconds are useful for short measurements, but formatting them does not improve the accuracy of the measurement source.
The examples target Windows PowerShell 5.1-compatible syntax and use .NET TimeSpan methods; they also apply in PowerShell 7. PowerShell 7 is cross-platform, while Windows PowerShell 5.1 is the legacy Windows edition. This is separate from date formatting: Microsoft notes some Get-Date formatting behavior and -UFormat specifiers differ between versions (Get-Date documentation). For organization-wide display conventions, PowerShell also supports custom formatting views, but a function is usually simpler for a single duration policy; see Format-Custom.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

