Commit 94e3625
authored
🚀 [Feature]: Add Get-CurrentDateTime function (#14)
The module now includes a new `Get-CurrentDateTime` function that
provides flexible date and time formatting options. You can retrieve the
current date/time in multiple preset formats or specify your own custom
format string, making it easier to generate timestamps for logging, file
naming, or display purposes.
- Fixes #15
## New function: Get-CurrentDateTime
A new public function `Get-CurrentDateTime` is available with the
following format options:
| Format | Description | Example Output |
|--------|-------------|----------------|
| `Default` | Standard timestamp format | `2026-01-20 14:30:45` |
| `Short` | Locale-specific short date | `1/20/2026` |
| `Long` | Locale-specific long date | `Monday, January 20, 2026` |
| `ISO8601` | ISO 8601 format with timezone |
`2026-01-20T14:30:45.1234567+01:00` |
| `Custom` | User-defined format string | Depends on `-CustomFormat`
parameter |
### Usage examples
```powershell
# Get current date/time in default format
Get-CurrentDateTime
# Returns: 2026-01-20 14:30:45
# Get ISO 8601 formatted timestamp
Get-CurrentDateTime -Format 'ISO8601'
# Returns: 2026-01-20T14:30:45.1234567+01:00
# Use a custom format
Get-CurrentDateTime -Format 'Custom' -CustomFormat 'dddd, MMMM dd, yyyy'
# Returns: Monday, January 20, 2026
```
## Tests included
Comprehensive Pester tests are included covering all format options to
ensure reliable functionality.1 parent f964789 commit 94e3625
2 files changed
Lines changed: 85 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 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 | + | |
24 | 49 | | |
0 commit comments