forked from jdhitsolutions/PSScriptTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConvertTo-LocalTime.yml
More file actions
100 lines (80 loc) · 2.83 KB
/
Copy pathConvertTo-LocalTime.yml
File metadata and controls
100 lines (80 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
examples:
- name: Example 1
preCode: ''
code: >-
PS C:\> ConvertTo-LocalTime "3/15/2019 7:00AM" 8:00:00
Thursday, March 14, 2019 7:00:00 PM
postCode: Convert a time that is in Singapore to local (Eastern) time.
- name: Example 2
preCode: ''
code: >-
PS C:\> get-timezone -ListAvailable | where id -match hawaii
Id : Hawaiian Standard Time
DisplayName : (UTC-10:00) Hawaii
StandardName : Hawaiian Standard Time
DaylightName : Hawaiian Daylight Time
BaseUtcOffset : -10:00:00
SupportsDaylightSavingTime : False
PS C:\> ConvertTo-LocalTime "10:00AM" -10:00:00
Thursday, March 14, 2019 4:00:00 PM
postCode: In this example, the user if first determining the UTC offset for Hawaii. Then 10:00AM in say Honolulu, is converted to local time which in this example is in the Eastern Time zone.
inputs:
- type: None
description: ''
links:
- href: https://github.com/jdhitsolutions/PSScriptTools/blob/master/docs/ConvertTo-LocalTime.md
text: 'Online Version:'
- href: ''
text: Get-TimeZone
- href: Get-MyTimeInfo.md
text: Get-MyTimeInfo
- href: Get-TZList.md
text: Get-TZList
- href: ConvertFrom-UTCTime.md
text: ConvertFrom-UTCTime
- href: ConvertTo-UTCTime.md
text: ConvertTo-UTCTime
module:
name: PSScriptTools
name: ConvertTo-LocalTime
notes: 'Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/'
optionalParameters:
- name: DaylightSavingTime
aliases:
- dst
defaultValue: None
description: Indicate that the foreign location is using Daylight Saving Time
parameterValueGroup: []
pipelineInput: False
position: Named
type: SwitchParameter
outputs:
- type: DateTime
description: ''
requiredParameters:
- name: Datetime
aliases: []
defaultValue: None
description: Enter a non-local date time
parameterValueGroup: []
pipelineInput: False
position: 0
type: DateTime
- name: UTCOffset
aliases:
- offset
defaultValue: None
description: Enter the location's' UTC Offset. You can use Get-Timezone to discover it.
parameterValueGroup: []
pipelineInput: True (ByPropertyName)
position: 1
type: TimeSpan
remarks: >-
It can be tricky sometimes to see a time in a foreign location and try to figure out what that time is locally. This command attempts to simplify this process. In addition to the remote time, you need the base UTC offset for the remote location. You can use Get-Timezone or Get-TZData to help. See examples.
The parameter for DaylightSavingTime is to indicate that the remote location is observing DST. You can use this with the location's standard UTC offset, or you can specify an offset that takes DST into account.
summary: Convert a foreign time to local
syntaxes:
- parameters:
- Datetime
- UTCOffset
- DaylightSavingTime