Get-NextPayDay.ps1
19 Sep 2025Description
Purpose
Retrieves the next payday from a CSV file.
Detailed Description
The Get-NextPayDay function reads a CSV file containing a list of payday dates and returns the next upcoming payday.
Usage
Example 1
Get-NextPayDay
This example retrieves the next payday from the PayDays.csv file and returns the corresponding countdown date.
Notes
Author: Your Name Date: Current Date
Script
<#
.SYNOPSIS
Retrieves the next payday from a CSV file.
.DESCRIPTION
The Get-NextPayDay function reads a CSV file containing a list of payday dates and returns the next upcoming payday.
.PARAMETER None
.INPUTS
None
.OUTPUTS
A custom object representing the next payday, including the number of days left until that payday.
.EXAMPLE
Get-NextPayDay
This example retrieves the next payday from the PayDays.csv file and returns the corresponding countdown date.
.NOTES
Author: Your Name
Date: Current Date
#>
function Get-NextPayDay {
$PayDays = Get-Content -Raw -Path $PSScriptRoot\resources\PayDays.csv | ConvertFrom-Csv
$PayDays | ForEach-Object -Process { New-CountdownDate -CountdownDay $_.PayDay } | Where-Object -FilterScript { $_.DaysLeft -notlike '-*' } | Select-Object -First 1
}
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.