Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting VBScript's Date Function

Windows PowerShell

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 -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:


Return to the VBScript to Windows PowerShell home page

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