external help file | Module Name | online version | schema |
---|---|---|---|
PSScriptTools-help.xml |
PSScriptTools |
2.0.0 |
Convert a local datetime to universal time.
ConvertTo-UTCTime [[-DateTime] <DateTime>] [-AsString] [<CommonParameters>]
Convert a local datetime to universal time. The default is now but you can specify a datetime value. You also have an option to format the result as a sortable string.
This command was introduced in v2.3.0.
PS C:\> Get-Date
Monday, December 28, 2020 7:43:13 PM
PS C:\> ConvertTo-UTCTime
Tuesday, December 29, 2020 12:43:37 AM
PS C:\> ConvertTo-UTCTime -asString
2020-12-29 00:44:01Z
Enter a Datetime value
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: now
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Convert the date-time value to a sortable string. This is the same thing as running a command like "{0:u}" -f (Get-Date).ToUniversaltime()
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/