Date and Time
I recently came across a script that used date and time information in this manner
This gives a result of
I didn’t like the way get-date was used three times – its messy . In most cases it won’t make much difference but if the script runs across a day boundary you just might get some odd results.
The same results can be achieved with
which will give a result of
The time differences are related to me clicking across different tabs in ISE
In this way we only call Get-date once and use the .NET string formatting to give the results we want. Much neater and we don’t need to worry about time or date boundaries