Display: Cloud | List
Most Popular Tags
Results (7 total) All > powershell (x) > system.datetime (x)
DateTime Sample Recoded Using PowerShell (DateTime Structure (System))
<#.SYNOPSIS This script shows how to compare roughy equivalent DateTime values, accepting a small margin of difference when declaring them equal..DESCRIPTION This script reimplements an MSDN Scample..NOTES File Name : Compare-DateTime.ps1 Author : Thomas Lee - tfl@psp.co.uk Requires : PowerShell Version 2.0.LINK This script posted to: http://www.pshscripts.bl
Last modified by Thomas Lee on 9/15/2010 7:43:02 PM
ConvertTime Method Sample, using PowerShell (TimeZoneInfo.ConvertTime Method (DateTime, TimeZoneInfo) (System))
<#.SYNOPSIS This script converts time using ConvertTime method. .DESCRIPTION This script re-implements an MSDN sample..NOTES File Name : Get-ConvertedTime.ps1 Author : Thomas Lee - tfl@psp.co.uk Requires : PowerShell Version 2.0.LINK This script posted to: http://www.pshscripts.blogspot.com MSDN Sample posted at: http://msdn.microsoft.com/en-us/library/
Last modified by Thomas Lee on 8/2/2010 11:33:20 AM
DayOfWeek example using PowerShell (DayOfWeek Enumeration (System))
<#.SYNOPSIS This script checks of a particular date in the past was a Thurday..DESCRIPTION This script creates a DateTime object set for 1st May, 2003. The script then check to see if that day is a Thursday then displays the day of week for that date (which is a Thursday). This script is a copy of the MSDN sample, written in PowerShell. .NOTES File Name : Get-Thursday.ps1
Last modified by Red-Devile on 8/5/2009 11:27:44 PM
Get-DateTime.ps1 (DateTimeFormatInfo Class (System.Globalization))
Above C# sample, re-written in PowerShell is on http://pshscripts.blogspot.com and http://powershell.com/cs/media/p/695.aspx MSDN Editor would not allow me to save this script here in the wiki. :-(
Last modified by Thomas Lee on 12/29/2008 9:57:54 AM
IsLeapYear method - using PowerShell (DateTime.IsLeapYear Method (System))
Here is a sample of the isleapyear static method - using PowerShell: $d1 = [system.datetime] "Jan 1 2000"$d2 = [System.datetime] "Jan 1 2002"$d3 = [System.datetime] "Jan 1 2004"$d4 = get-date"{0} is a leap year: {1}" -f $d1.year,([system.datetime]::isleapyear($d1.year))"{0} is a leap year: {1}" -f $d2.year,([system.datetime]::isleapyear($d2.year))"{0} is a leap year: {1}" -f $d3.year,(
Last modified by Timothy Tannyer on 7/3/2008 11:25:02 PM
Instantiating a DateTime Object using PowerShell (DateTime Structure (System))
Sample showing how to instantiate a datetime object in PowerShell[System.DateTime] $date1 = [System.DateTime]::Now[System.DateTime] $date2 = [System.DateTime]::UtcNow[system.datetime] $date3 = [system.DateTime]::Today"Time is now = $date1""Time in UTC now = $date2""Time Today is = $date3"
Last modified by Thomas Lee on 5/18/2009 7:38:37 AM
DateTime.Ticks using PowerShell (DateTime.Ticks Property (System))
# get-datetimeticks.ps1# displays ticks from date/time# Thomas Lee - tfl@psp.co.uk # setup up dates$centuryBegin = new-object System.DateTime 2001, 1, 1$currentDate = [System.DateTime]::Now$elapsedTicks = $currentDate.Ticks - $centuryBegin.Ticks$elapsedSpan = new-object system.TimeSpan $elapsedTicks # display output"Current date: {0}" -f $currentdate"Elapsed from the beginning of the cent
Last modified by Thomas Lee on 4/20/2008 10:16:44 AM
Page view tracker