
- PowerShell Tutorial
- PowerShell - Home
- PowerShell - Overview
- PowerShell - Environment Setup
- PowerShell - Cmdlets
- PowerShell - Files and Folders
- PowerShell - Dates and Timers
- PowerShell - Files I/O
- PowerShell - Advanced Cmdlets
- PowerShell - Scripting
- PowerShell - Special Variables
- PowerShell - Operators
- PowerShell - Looping
- PowerShell - Conditions
- PowerShell - Array
- PowerShell - Hashtables
- PowerShell - Regex
- PowerShell - Backtick
- PowerShell - Brackets
- PowerShell - Alias
- PowerShell Useful Resources
- PowerShell - Quick Guide
- PowerShell - Useful Resources
- PowerShell - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Powershell - Set System Date
Cmdlet
Set-Date cmdlet is used to set System Date.
In this example, we're using Get-Date to get current date
Type the following command in PowerShell ISE Console
Get-Date
Output
You can see following output in PowerShell console.
Get-Date Saturday, May 05, 2018 9:58:06 AM
In this example, we're using Set-Date to add one more day to current date.
Type the following command in PowerShell ISE Console
set-date -Date (Get-Date).AddDays(1)
Output
You can see following output in PowerShell console.
Sunday, May 06, 2018 9:59:16 AM
Now revert back to substract added day to current date.
Type the following command in PowerShell ISE Console
set-date -Date (Get-Date).AddDays(-1)
Output
You can see following output in PowerShell console.
Saturday, May 05, 2018 10:00:37 AM
powershell_dates_timers.htm
Advertisements