19 lines
878 B
PowerShell
19 lines
878 B
PowerShell
#Script créé par Nicolas Lang - Sous licence CC-BY-SA
|
|
#https://nicolaslang.fr
|
|
|
|
$today = Get-Date
|
|
$cible = [datetime]"12/16/2016"
|
|
|
|
$feries = @([datetime]"01/01",[datetime]"05/01",[datetime]"05/08",[datetime]"07/14",[datetime]"08/15",[datetime]"11/1",[datetime]"11/11",[datetime]"12/25")
|
|
$feries += @([datetime]"04/21/2014",[datetime]"05/29/2014",[datetime]"06/09/2014",[datetime]"04/06/2015",[datetime]"05/14/2015",[datetime]"05/25/2015")
|
|
#ajoutez les jours qui sont fériés en conservant cette syntaxe
|
|
$joursouvres = 1
|
|
while ($today.ToLongDateString() -ne $cible.ToLongDateString())
|
|
{
|
|
if (($today.DayOfWeek -ne "Sunday") -and ($today.DayOfWeek -ne "Saturday") -and ($feries.tolongdatestring() -notcontains $today.tolongdatestring()))
|
|
{
|
|
$joursouvres++
|
|
}#fin if
|
|
$today = $today.AddDays(1)
|
|
}#fin while
|
|
Write-Host $joursouvres "jour(s) ouvré(s), aujourd'hui inclus" |