powrshell datetime object

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 5 months ago.

  • Author
    Posts
  • #5611

    by binary01 at 2013-03-01 07:46:25

    hello:
    i try to get the propertes and the methods of datetime, so i try a first command [datetime] | get-member, the second command i tried is
    [datetime] :: with tab completion, and the result was differrent for example the method FromFileTime() is listed only with the second command not with the first, so what is the difference...?
    thank you in advance

    by mjolinor at 2013-03-01 07:55:40

    There are 2 kinds of methods and properties, instance and static.
    The :: notation is used to get static methods and properties, and the dot operator is used for instance methods and properties.
    Get-Member by default only returns instance properties and methods. Use the -Static switch to return the static properties and methods.

    [datatime] | Get-Member -Static

    by nohandle at 2013-03-01 13:23:23

    or -force to get all. 🙂

    by mjolinor at 2013-03-01 13:32:36

    Actually, you still have to specify -Static with -Force to see the static methods and properties.

You must be logged in to reply to this topic.