Converting VBScript's Now Function

Definition: Returns the current date and time according to the setting of your computer's system date and time.


If you’re looking for easy one then you came to the right place: assigning the current date and time to a variable is no more difficult than using the Get-Date Cmdlet. For example:

$a = get-date

When you run this command and then echo back the value of $a you should get something similar to the following:

Tuesday, September 05, 2006 10:24:04 AM

Return to the VBScript to Windows PowerShell home page