How it works...
The object that is returned by Get-Date has several methods just as it has properties. In this recipe, we use the methods to manipulate the date the way we need it. Methods are called with arguments. When you do not want to specify any argument, make sure to still call the methods with an empty pair of parentheses.
Methods can be chained in the way we did when adding hours as well as minutes. As long as the output object does not change, in most cases, you should be able to call methods pertaining to the object by chaining them. If, for instance, you convert the date object into a string at the first method, the second method should be a string input-enabled method. When in doubt, use the Get-Member cmdlet on the output to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access