Export (0) Print
Expand All
Expand Minimize

Converting VBScript's Date Function


Windows PowerShell


Definition: Returns the current system date.

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 -format d (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:


9/1/2006


Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft