PowerTip: Use PowerShell to Create Future Dates

PowerTip: Use PowerShell to Create Future Dates

  • Comments 7
  • Likes

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:


Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • How about:





  • @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*

  • @Ed

    Adding weeks and months is very useful.

  • Aha!  So with Windows PowerShell I can have my very own TARDIS! :)

  • @Sean

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


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

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

  • Is this an error:

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

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