Is there a way to show only the time in this?

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Vandrey Trindade Vandrey Trindade 6 months, 3 weeks ago.

  • Author
    Posts
  • #39321
    Profile photo of Vandrey Trindade
    Vandrey Trindade
    Participant

    Hi,

    I'm trying to show only the time on this:

    (get-date -displayhint time).addminutes(35)

    But it show everything... =/
    Any idea how to make it? I want only the hours and the minutes (Ex.: 09:35)

  • #39322
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Sure. If you were to pipe your result to Get-Member, you'll see a number of properties and methods that let you access portions of the date/time object. For example...

    $tomorrow = (Get-Date).AddDays(1)
    $tomorrow | gm

    I often use...

    $tomorrow.ToShortDate()

    When I need a short date. You might want ToShortTimeString() or something.

  • #39324
    Profile photo of Vandrey Trindade
    Vandrey Trindade
    Participant

    Thanks once again Don Jones!

You must be logged in to reply to this topic.