Voici une manière simple de lister toutes les méthodes liées à [DateTime] et donc de retrouver comment l’utiliser :
[DateTime]::Now |Get-Member -MemberType Method
TypeName: System. | DateTime | |
Name | MemberType | Definition |
—- | ———- | ———- |
Add | Method | System.DateTime Add(TimeSpan value) |
AddDays | Method | System.DateTime AddDays(Double value) |
AddHours | Method | System.DateTime AddHours(Double value) |
AddMilliseconds | Method | System.DateTime AddMilliseconds(Double v… |
AddMinutes | Method | System.DateTime AddMinutes(Double value) |
AddMonths | Method | System.DateTime AddMonths(Int32 months) |
AddSeconds | Method | System.DateTime AddSeconds(Double value) |
AddTicks | Method | System.DateTime AddTicks(Int64 value) |
AddYears | Method | System.DateTime AddYears(Int32 value) |
CompareTo | Method | System.Int32 CompareTo(Object value), Sy… |
Equals | Method | System.Boolean Equals(Object value), Sys… |
GetDateTimeFormats | Method | System.String[] GetDateTimeFormats(), Sy… |
GetHashCode | Method | System.Int32 GetHashCode() |
GetType | Method | System.Type GetType() |
GetTypeCode | Method | System.TypeCode GetTypeCode() |
… | ||
IsDaylightSavingTime | Method | System.Boolean IsDaylightSavingTime() |
Subtract | Method | System.TimeSpan Subtract(DateTime value)… |
ToBinary | Method | System.Int64 ToBinary() |
ToFileTime | Method | System.Int64 ToFileTime() |
ToFileTimeUtc | Method | System.Int64 ToFileTimeUtc() |
ToLocalTime | Method | System.DateTime ToLocalTime() |
ToLongDateString | Method | System.String ToLongDateString() |
ToLongTimeString | Method | System.String ToLongTimeString() |
ToOADate | Method | System.Double ToOADate() |
ToShortDateString | Method | System.String ToShortDateString() |
ToShortTimeString | Method | System.String ToShortTimeString() |
ToString | Method | System.String ToString(), System.String … |
ToUniversalTime | Method | System.DateTime ToUniversalTime() |
Bonne utilisation.