Skip to content

Commit 4cb3edd

Browse files
see changelog for v2.7.0
1 parent 6365005 commit 4cb3edd

19 files changed

+1251
-221
lines changed

PSScriptTools.psd1

304 Bytes
Binary file not shown.

README.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,57 @@ Thursday, March 14, 2019 4:00:00 PM
814814

815815
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.
816816

817+
### [Get-TZList](docs/Get-TZList.md)
818+
819+
This command uses a free and publicly available REST API offered by [http://worldtimeapi.org](http://worldtimeapi.org) to get a list of time zone areas. You can get a list of all areas or by geographic location. Use Get-TZData to then retrieve details.
820+
821+
```powershell
822+
PS S:\PSScriptTools> get-tzlist Australia
823+
Australia/Adelaide
824+
Australia/Brisbane
825+
Australia/Broken_Hill
826+
Australia/Currie
827+
Australia/Darwin
828+
Australia/Eucla
829+
Australia/Hobart
830+
Australia/Lindeman
831+
Australia/Lord_Howe
832+
Australia/Melbourne
833+
Australia/Perth
834+
Australia/Sydney
835+
```
836+
837+
### [Get-TZData](docs/Get-TZData.md)
838+
839+
This command also uses the API from worldtimeapi.org to retrieve details about a give time zone area.
840+
841+
```powershell
842+
PS C:\> Get-TZData Australia/Hobart
843+
844+
Timezone Label Offset DST Time
845+
-------- ----- ------ --- ----
846+
Australia/Hobart AEDT 11:00:00 True 3/16/2019 3:43:14 AM
847+
```
848+
849+
The Time value is the current time at the remote location. The command presents a formatted object but you can also get the raw data.
850+
851+
```powershell
852+
PS C:\> Get-TZData Australia/Hobart -Raw
853+
854+
855+
week_number : 11
856+
utc_offset : +11:00
857+
unixtime : 1552668285
858+
timezone : Australia/Hobart
859+
dst_until : 2019-04-06T16:00:00+00:00
860+
dst_from : 2018-10-06T16:00:00+00:00
861+
dst : True
862+
day_of_year : 75
863+
day_of_week : 6
864+
datetime : 2019-03-16T03:44:45.689655+11:00
865+
abbreviation : AEDT
866+
```
867+
817868
## Console Utilities
818869

819870
### [Set-ConsoleTitle](docs/Set-ConsoleTitle.md)
@@ -840,4 +891,4 @@ PS C:\> Set-ConsoleColor -background DarkGray -foreground Yellow
840891

841892
Where possible these commands have been tested with PowerShell Core, but not every platform. If you encounter problems, have suggestions or other feedback, please post an issue.
842893

843-
*last updated 14 March, 2019*
894+
*last updated 15 March, 2019*

changelog.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
# Change Log for PSScriptTools
22

3+
## v2.7.0
4+
5+
+ Modified `ConvertTo-LocalTime` to allow for locations supporting Daylight Saving Time (Issue #44)
6+
+ Fixed bug in `New-PSFormatXML` that wasn't using auto detected property names (Issue #45)
7+
+ Added `Get-TZList` and `Get-TZData` commands
8+
+ Added format file `timeZoneData.format.ps1xml`
9+
+ Modified `ConvertTo-WPFGrid` to allow the user to control which gridlines are displayed
10+
+ Modified `New-CustomFilename` to improve parameter help.
11+
+ Modified `New-CustomFilename` to add %seconds.
12+
+ Modified `New-CustomFilename` so that %month, %day and %minute will use a leading zero if necessary
13+
+ Added new help examples for `New-CustomFilename`
14+
+ Help updates
15+
+ File re-organization
16+
+ Updated `README.md`
17+
318
## v2.6.0
419

520
+ Modified `Convertto-WPFGrid` to set maximum size equal to total available working area (Issue #36)
621
+ Modified `Convertto-WPFGrid` to change cursor on refresh and display a refresh message in the title bar
722
+ Added InitializationScript option for `ConvertTo-WPFGrid` (Issue #42)
823
+ Added `ConvertTo-LocalTime` with an alias of `clt`
24+
+ Updated `README.md`
925
+ Help updates
1026

1127
## v2.5.0

docs/ConvertTo-WPFGrid.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,24 @@ Send command output to an interactive WPF-based grid.
1616
### input (Default)
1717

1818
```yaml
19-
ConvertTo-WPFGrid [[-Title] <String>] [[-Timeout] <Int32>] [-Refresh] [-InitializationScript <ScriptBlock>]
20-
[-UseLocalVariable <String[]>] [-UseProfile] [<CommonParameters>]
19+
ConvertTo-WPFGrid [[-Title] <String>] [[-Timeout] <Int32>] [-Refresh] [-Gridlines <String>]
20+
[-InitializationScript <ScriptBlock>] [-UseLocalVariable <String[]>] [-UseProfile] [<CommonParameters>]
2121
```
2222

2323
### Input
2424

2525
```yaml
2626
ConvertTo-WPFGrid [[-InputObject] <PSObject>] [[-Title] <String>] [[-Timeout] <Int32>] [-Refresh]
27-
[-InitializationScript <ScriptBlock>] [-UseLocalVariable <String[]>] [-UseProfile] [<CommonParameters>]
27+
[-Gridlines <String>] [-InitializationScript <ScriptBlock>] [-UseLocalVariable <String[]>] [-UseProfile]
28+
[<CommonParameters>]
2829
```
2930

3031
### scriptblock
3132

3233
```yaml
3334
ConvertTo-WPFGrid [-Scriptblock <ScriptBlock>] [[-Title] <String>] [[-Timeout] <Int32>] [-Refresh]
34-
[-InitializationScript <ScriptBlock>] [-UseLocalVariable <String[]>] [-UseProfile] [<CommonParameters>]
35+
[-Gridlines <String>] [-InitializationScript <ScriptBlock>] [-UseLocalVariable <String[]>] [-UseProfile]
36+
[<CommonParameters>]
3537
```
3638

3739
## DESCRIPTION
@@ -214,6 +216,22 @@ Accept pipeline input: False
214216
Accept wildcard characters: False
215217
```
216218
219+
### -Gridlines
220+
221+
Control how grid lines are displayed in the form. You may not want to have any or perhaps only vertical or horizontal lines.
222+
223+
```yaml
224+
Type: String
225+
Parameter Sets: (All)
226+
Aliases:
227+
228+
Required: False
229+
Position: Named
230+
Default value: None
231+
Accept pipeline input: False
232+
Accept wildcard characters: False
233+
```
234+
217235
### CommonParameters
218236
219237
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

docs/Convertto-LocalTime.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ online version:
55
schema: 2.0.0
66
---
77

8-
# Convertto-LocalTime
8+
# ConvertTo-LocalTime
99

1010
## SYNOPSIS
1111

@@ -14,12 +14,14 @@ Convert a foreign time to local
1414
## SYNTAX
1515

1616
```yaml
17-
Convertto-LocalTime [-Datetime] <DateTime> [-UTCOffset] <TimeSpan> [<CommonParameters>]
17+
ConvertTo-LocalTime [-Datetime] <DateTime> [-UTCOffset] <TimeSpan> [-DaylightSavingTime] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
2121

22-
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 to help. See examples.
22+
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.
23+
24+
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.
2325

2426
## EXAMPLES
2527

@@ -78,19 +80,34 @@ Enter the location's' UTC Offset. You can use Get-Timezone to discover it.
7880
```yaml
7981
Type: TimeSpan
8082
Parameter Sets: (All)
81-
Aliases:
83+
Aliases: offset
8284

8385
Required: True
8486
Position: 1
8587
Default value: None
88+
Accept pipeline input: True (ByPropertyName)
89+
Accept wildcard characters: False
90+
```
91+
92+
### -DaylightSavingTime
93+
94+
Indicate that the foreign location is using Daylight Saving Time
95+
96+
```yaml
97+
Type: SwitchParameter
98+
Parameter Sets: (All)
99+
Aliases: dst
100+
101+
Required: False
102+
Position: Named
103+
Default value: None
86104
Accept pipeline input: False
87105
Accept wildcard characters: False
88106
```
89107
90108
### CommonParameters
91109
92-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
93-
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
110+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
94111
95112
## INPUTS
96113
@@ -108,8 +125,10 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
108125
109126
[Get-TimeZone]()
110127
111-
[Get-MyTimeInfo]()
128+
[Get-MyTimeInfo](Get-MyTimeInfo.md)
129+
130+
[Get-TZList](Get-TZList.md)
112131
113-
[ConvertFrom-UTCTime]()
132+
[ConvertFrom-UTCTime](ConvertFrom-UTCTime.md)
114133
115-
[ConvertTo-UTCTime]()
134+
[ConvertTo-UTCTime](ConvertTo-UTCTime.md)

docs/Get-TZData.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
---
2+
external help file: PSScriptTools-help.xml
3+
Module Name: PSScriptTools
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# Get-TZData
9+
10+
## SYNOPSIS
11+
12+
Get time zone details
13+
14+
## SYNTAX
15+
16+
```yaml
17+
Get-TZData [-TimeZoneArea] <String> [-Raw] [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
This command uses a free and publicly available REST API offered by http://worldtimeapi.org to get information about a time zone. You can use Get-TZList to find an area and this command to display the details. The time zone area name is case-sensitive. The default is to write a custom object to the pipeline, but you also have an option of seeing the raw data that is returned from the API. On PowerShell Core, the raw data will be slightly different.
23+
24+
Note that if the site is busy you may get an error. If that happens, wait a minute and try again.
25+
26+
## EXAMPLES
27+
28+
### Example 1
29+
30+
```powershell
31+
PS C:\> Get-TZData Australia/Hobart
32+
33+
PS S:\PSScriptTools> Get-TZData Australia/Hobart
34+
35+
Timezone Label Offset DST Time
36+
-------- ----- ------ --- ----
37+
Australia/Hobart AEDT 11:00:00 True 3/16/2019 5:35:46 AM
38+
```
39+
40+
Get time zone information for Hobart.
41+
42+
### Example 2
43+
44+
```powershell
45+
PS C:\> Get-TZData Asia/Tokyo -Raw
46+
47+
48+
week_number : 11
49+
utc_offset : +09:00
50+
unixtime : 1552674997
51+
timezone : Asia/Tokyo
52+
dst_until :
53+
dst_from :
54+
dst : False
55+
day_of_year : 75
56+
day_of_week : 6
57+
datetime : 2019-03-16T03:36:37.829505+09:00
58+
abbreviation : JST
59+
```
60+
61+
Get time zone information for Tokyo as a raw format.
62+
63+
### Example 3
64+
65+
```powershell
66+
PS C:\> Get-TZList Antarctica | Get-TZData | Sort-Object Offset
67+
68+
Timezone Label Offset DST Time
69+
-------- ----- ------ --- ----
70+
Antarctica/Rothera -03 -03:00:00 False 3/15/2019 3:39:59 PM
71+
Antarctica/Palmer -03 -03:00:00 False 3/15/2019 3:39:59 PM
72+
Antarctica/Troll +00 00:00:00 False 3/15/2019 6:40:00 PM
73+
Antarctica/Syowa +03 03:00:00 False 3/15/2019 9:39:59 PM
74+
Antarctica/Mawson +05 05:00:00 False 3/15/2019 11:39:59 PM
75+
Antarctica/Vostok +06 06:00:00 False 3/16/2019 12:40:00 AM
76+
Antarctica/Davis +07 07:00:00 False 3/16/2019 1:39:58 AM
77+
Antarctica/Casey +08 08:00:00 False 3/16/2019 2:39:58 AM
78+
Antarctica/DumontDUrville +10 10:00:00 False 3/16/2019 4:39:58 AM
79+
Antarctica/Macquarie +11 11:00:00 False 3/16/2019 5:39:58 AM
80+
```
81+
82+
Get all time zone areas in Antarctica and pipe them to Get-TZData to retrieve the details.
83+
84+
### Example 4
85+
86+
```powershell
87+
PS C:\> Get-TZData Europe/Rome | ConvertTo-LocalTime -Datetime "3/15/2019 4:00PM"
88+
89+
Friday, March 15, 2019 11:00:00 AM
90+
```
91+
92+
Convert the datetime in Rome to local time, which in this example is Eastern time.
93+
94+
## PARAMETERS
95+
96+
### -Raw
97+
98+
Return raw, unformatted data. Due to the way PowerShell Core automatically wants to format date time strings, raw output had to be slightly adjusted.
99+
100+
```yaml
101+
Type: SwitchParameter
102+
Parameter Sets: (All)
103+
Aliases:
104+
105+
Required: False
106+
Position: Named
107+
Default value: None
108+
Accept pipeline input: False
109+
Accept wildcard characters: False
110+
```
111+
112+
### -TimeZoneArea
113+
114+
Enter a timezone location like Pacific/Auckland. It is case sensitive. Use Get-TZList to retrieve a list of areas.
115+
116+
```yaml
117+
Type: String
118+
Parameter Sets: (All)
119+
Aliases:
120+
121+
Required: True
122+
Position: 0
123+
Default value: None
124+
Accept pipeline input: True (ByValue)
125+
Accept wildcard characters: False
126+
```
127+
128+
### CommonParameters
129+
130+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
131+
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
132+
133+
## INPUTS
134+
135+
### System.String
136+
137+
## OUTPUTS
138+
139+
### PSCustomObject
140+
141+
### TimeZoneData
142+
143+
## NOTES
144+
145+
Learn more about PowerShell:http://jdhitsolutions.com/blog/essential-powershell-resources/
146+
147+
## RELATED LINKS
148+
149+
[Get-TZList](Get-TZList.md)
150+

0 commit comments

Comments
 (0)