Auteur Sujet: How to calculate flexible vacation days, and moor  (Lu 6301 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne Arenas

  • Newbie
  • *
  • Messages: 17
  • Karma : 2
    • Voir le profil
    • http://arenas.pagesperso-orange.fr/GradientExample/france-countdown.html
How to calculate flexible vacation days, and moor
« le: mars 26, 2024, 17:35:46 pm »
cls



" 1 Sripte"
"==========================================="
""
"Use each script individually"
" - How to calculate flexible vacation days"
" - What season is it now?"
" - Find left day(s) of the Year active"
""
"==========================================="

""
" How to calculate flexible vacation days"
" For:"
" - Ash Wednesday,"
" - Easter,"
" - The first Advent Day"
" there are other days like this in the year ..... "
""

"Us PowerShell any version"

# We are in 2024.
$YYYY = (Get-Date).Year

# this is the 1. fool luna, the reel luna year at this moment is the ....
""
""
"  "" The reel Luna Year at this moment is for the: "" " + ($yyyy-1)
"  If the "" Men "" (Luna-Month-Name) is equale at the "" Nisannu """
"  and "" Hemera "" (Luna-Day) is the first-day = 1;"
"  The year will by crow to the next "" Etos "" (Year) = "" $YYYY "" "
""
""
" Tis exemple works only for 2024, of the Luna/ Earth Kalender"
""

""
$Ash_Wednesday = '14-02-2024'
$ts1 = New-TimeSpan -Start $date_full_luna -End $cendre
$Ash_Wednesday2 = (Get-Date $date_full_luna).AddDays($ts1.Days).ToString("ddd d MMM yyyy")
"--------------------------------------------"
"  " + $Ash_Wednesday2 + " "" Get Ash Wednesday $YYYY """
"--------------------------------------------"

$date_full_luna = Get-Date "11 - 01 - $YYYY"
$date_easter = (Get-Date $date_full_luna).AddDays(80).ToString("ddd d MMM yyyy")
"-------------------------------------------"
"  " + $date_easter + " "" Get Easter for $YYYY """
"-------------------------------------------"
""" The Kalendar cycle start, ordone par Rom """
$first_advent = '01-12-2024'
$ts = New-TimeSpan -Start $date_full_luna -End $first_advent
$first_advent = (Get-Date $date_full_luna).AddDays($ts.Days).ToString("ddd d MMM yyyy")
"----------------------------------------------------"
"  " + $first_advent + " "" Get the first Advent-Day $YYYY """
"----------------------------------------------------"
""
" - Tat's all - "
"Arenas 25 March 2024"

"================================="

"Us only the yellow champs"
Luna Kalender for Excel


Rapport-luna-earth-march-2024

Rapport-luna-earth-april-2024




" 2 Another script"

"==========================="
"What season we have now ?"
"Us also PawerShell, any version."

Cls

$Date = Get-Date

Function Get-Season([datetime]$Date){
    If (!$Date) {$Date = Get-Date}
   
    #If date was not provided, assume today.
    # The dates are obviously not exactly accurate and are best guesses

    $Spring = Get-Date -Day 20 -Month 03 -Year $Date.Year
    $Summer = Get-Date -Day 21 -Month 06 -Year $Date.Year
    $Autumn = Get-Date -Day 22 -Month 09 -Year $Date.Year
    $Winter = Get-Date -Day 21 -Month 12 -Year $Date.Year
    $Season = switch($Date) {
        {($_ -lt $Spring)}  {"Winter";Break}
        {($_ -lt $Summer)}  {"Spring";Break}
        {($_ -lt $Autumn)}  {"Summer";Break}
        {($_ -lt $Winter)}  {"Autumn";Break}
        {($_ -ge $Winter)}  {"Winter"}
    }
    "{0:d} is in season {1}" -f $Date,$Season
}

""
"------------------------------"
    Get-Season
"------------------------------"






""
"================================="

" 3 Find the past days of 2 dates"


cls
""
""
" Synopsys 1 : Find left day(s) of the Year active"
""

"-------------------------------------------------"
""" Study from: ** 2023 oct. 14, from arenas. ** """
"-------------------------------------------------"

""
"    Days of Year ""minus"" Day of Year
    = Days of Year ""minus"" Day of Year
    -eq left Days for the Year active,
    as one Liner"
""
"The whole calculation process"
"    " +[string]([datetime]'12/31' - [datetime]'1/1' | % days) + " - " + [string](Get-Date).dayofyear`
 + " = "" left Day(s) for "" " + [string](Get-Date).year + ", " +(((Get-Date).dayofyear) - `
(([datetime]'12/31' - [datetime]'1/1') | % days))+ " Days"
""
"    Rigth ? "
""

""" Or """
"Short version"
""
 $xday_left_year = ((Get-Date).dayofyear) - (([datetime]'12/31' - [datetime]'1/1') | % days)
 $xday_left_year

 ""
« Modifié: mai 03, 2024, 07:39:40 am par Arenas »