Converting VBScript's Second Function

Definition: Returns a whole number between 0 and 59, inclusive, representing the second of the minute.

Second

Is it useful for you to be able to take a specified date and time and throw out everything but the seconds? In other words, if today is 12:29:16 on 9/30/2006, is it useful for you to be able to determine that the seconds are equal to 16?

To tell you the truth, we don’t know whether that’s useful or not. If it is useful, however, you can do that in Windows PowerShell by using the Get-Date Cmdlet and then examining the value of the Second property:

$a = (get-date).second

When you run this command (assuming it really is 12:29:16 on 9/30/2006) and then echo back the value of $a you should get the following:

16

Return to the VBScript to Windows PowerShell home page