Time


Definition: Returns a Variant of subtype Date indicating the current system time.

 

OK, give us a hard one. What’s that? You’d like to store just the current time – and only the current time – in a variable? Fortunately, that’s not very hard; for example, one way we can do that is to call the Get-Date Cmdlet, then use the –displayhint parameter to assign just the current time to a variable. Sort of like this command, in which we store the current time to the variable $a:

 

$a = get-date -displayhint time

 

When you run this command and then echo back the value of $a you should get the following (assuming you run it at 11:22:37 AM):

 

11:22:37 AM