FormatDateTime
Definition: Returns an expression formatted as a date or
time.
The .NET Framework enables you to create a vast array of custom date formats, far too many to cover in this introductory guide. Fortunately, you can create the four basic date-time formats without having to use any fancy (and sometimes confusing) custom formatting strings. Instead, just employ the four methods shown below:
$a = (get-date).
tolongdatestring
()
$a = (get-date).
toshortdatestring()
$a = (get-date).
tolongtimestring()
$a = (get-date).
toshorttimestring()
When you run these commands and then echo back the values of $ a youshould get something similar to the following, in order: