PowerTip: Use PowerShell to Create Future Dates

Summary: Use Windows PowerShell to create a date in the future.

Hey, Scripting Guy! Question How can I easily create dates in the future?

Hey, Scripting Guy! Answer Use the Get-Date cmdlet and add days to it:


Comments (7)

  1. jrv says:


    Adding weeks and months is very useful.

  2. jrv says:

    How about:





  3. jrv says:


    "May  the Power of the Shell be with you my son"


  4. jrv says:

    Is this an error:

    PS > ([datetime]0).AddYears(0)

    Monday, January 1, 0001 12:00:00 AM

  5. So simple, yet so useful, been using this one for I don't know how long

    subtraction is easy too, (Get-Date).adddays(-7)

  6. Ed Wilson says:

    @JRV absolutely 🙂

    In fact, you can find all of the things you can add, by using this code:

    Get-Date | get-member -MemberType method add*

  7. Sean Kearney says:

    Aha!  So with Windows PowerShell I can have my very own TARDIS! 🙂