Skip to content

🚀 [Feature]: Add Get-CurrentDateTime function#14

Merged
MariusStorhaug merged 2 commits into
mainfrom
feature/add-test-datetime-function
Jan 20, 2026
Merged

🚀 [Feature]: Add Get-CurrentDateTime function#14
MariusStorhaug merged 2 commits into
mainfrom
feature/add-test-datetime-function

Conversation

@MariusStorhaug

@MariusStorhaug MariusStorhaug commented Jan 20, 2026

Copy link
Copy Markdown
Owner

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.

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

# 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.

@github-actions

Copy link
Copy Markdown

Module MariusTestModule - 0.3.0-featureaddtestdatetimefunction001 published to the PowerShell Gallery.

@github-actions

Copy link
Copy Markdown

GitHub release for MariusTestModule v0.3.0-featureaddtestdatetimefunction001 has been created.

@MariusStorhaug MariusStorhaug changed the title feat: Add Get-CurrentDateTime function 🚀 [Feature]: Add Get-CurrentDateTime function Jan 20, 2026
@MariusStorhaug
MariusStorhaug merged commit 94e3625 into main Jan 20, 2026
36 checks passed
@MariusStorhaug
MariusStorhaug deleted the feature/add-test-datetime-function branch January 20, 2026 00:23
@github-actions

Copy link
Copy Markdown

Module MariusTestModule - 0.3.0 published to the PowerShell Gallery.

@github-actions

Copy link
Copy Markdown

GitHub release for MariusTestModule v0.3.0 has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add Get-CurrentDateTime function for flexible timestamp formatting

1 participant