Converting VBScript's Date Function

Definition: Returns the current system date.


In VBScript you can use the Date function to assign the current date (and only the current date, not the current time as well) to a variable. In Windows PowerShell you can do the same thing by calling the Get-Date Cmdlet and using the -formatd (for date) parameter. For example, this command assigns the current date to the variable $a:

$a = get-date -format d

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


Return to the VBScript to Windows PowerShell home page