Skip to content

Instantly share code, notes, and snippets.

@martin9700

martin9700/Get-Quarter.ps1

Last active Nov 15, 2016
Embed
What would you like to do?
#Define Quarters
$Quarters = @{}
$Start = Get-Date -Month 1 -Date 1 -Year (Get-Date).Year
ForEach ($Q in (1..4))
{
$Quarters.Add($Q,[PSCustomObject]@{
From = $Start
To = $Start.AddMonths(3).AddTicks(-1)
})
$Start = $Start.AddMonths(3)
}
#Define this quarter
$Quarter = [int]([math]::Ceiling((Get-Date -Format MM)/3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.