In scripts the DATE is very useful, in my most of the scripts i always use $DATE variable. This became very handy when you want to save the output of the script to a file name and the file name contains the date as name.
There are few tricks which i always used with Get-Date. let me show few of them,
- When i want to add dates in Registry entries or keys, i always tried to convert then to the String
$date = (Get-Date).toString()
2. When i want to specify a one week old date , i use .AddDays Method, You can add days or use minus days in current day.
3. If we want a customise output of the date as per our requirements we can use a -Format parameter.
that’s all for now
Happy Playing with the TIME ;o)
Happy Weekend …