Get-Date And AddDays Automaticly change Format of date and make Error !

Welcome Forums General PowerShell Q&A Get-Date And AddDays Automaticly change Format of date and make Error !

Viewing 25 reply threads
  • Author
    Posts
    • #216891
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Hello all ^^,

      I need to do a while to AddDays to the Initial Date like this :
      The $Start or $Stop Variable need to be a string when the command line with the split are execute !

       

      $Start = "01/02/2020 16:00"
      $Stop = "02/02/2020 06:00"
      $StopHebdo = "05/02/2020 06:00"
      $JourDiff = (New-TimeSpan -start $Start -End $StopHebdo).Days
      Write-Host "DiffJour: $JourDiff"
      $i = 0
      $StartTimeJ = @()
      $StopTimeJ = @()
      
      #Gros problème de format de date lors du New-TimeSpan !
      While($i -le $jourDiff){
          Write-Host "#######################"
          Write-Host "$i"
          Write-Host "Avant-AddDays: $Start"
          #Write-Host "Avant-Stop: $Stop"
          Write-Host " " 
          #[Datetime]$Start = $Start
          [string]$DateStart = (Get-Date  -Date $Start).AddDays($i) 
          Write-Host "ApresAddDays-Start: $Start"
          [string]$DateStop = (Get-Date $Stop).AddDays($i)
          #Write-Host "ApresAddDays-Stop: $Stop"
          Write-Host " " 
          [String]$Start = $DateStart
          $StartTimeJ += (New-TimeSpan -Start ($DateStart.Split(" ")[0]) -End $DateStart).TotalSeconds 
          $StopTimeJ += (New-TimeSpan -Start $DateStart -End $DateStop).TotalSeconds
          $i++
      }
      

      Result:

      DiffJour: 3
      #######################
      0
      Avant-AddDays: 01/02/2020 16:00
       
      ApresAddDays-Start: 01/02/2020 16:00
       
      #######################
      1
      Avant-AddDays: 02/01/2020 16:00:00
       
      ApresAddDays-Start: 02/01/2020 16:00:00
       
      #######################
      2
      Avant-AddDays: 01/03/2020 16:00:00
       
      ApresAddDays-Start: 01/03/2020 16:00:00
       
      #######################
      3
      Avant-AddDays: 03/03/2020 16:00:00
       
      ApresAddDays-Start: 03/03/2020 16:00:00
      

      (Format Date is: dd/mm/YYYY HH:MM)As you see after the AddDays (Format is: mm/dd/YYYY HH:MM)
      and each time the AddDays is execute the format is switch !
      I have try with [Datetime] just before the AdfdDays but seem’s to be same error !

      Thx for Help ^^

    • #216897
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      Could you please explain a little more detailed what you are trying to do (not the attempted solution you think you need). And if you get errors you shoud post them as well please (formatted as code as well please).

    • #216912
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Hello OLaf ^^
      How are you ?

      It’s again for my NetBackup Script, i need to Fill the command line for set a Incremental Schedule of a backup Policy.
      The command line is :
      StartTimeJ and StopTimeJ are an array.

      .\bpplscedwin -0 StartTimeJ StopTimeJ -1 StartTimeJ StopTimeJ -2 StartTimeJ StopTimeJ -3 StartTimeJ StopTimeJ -4 StartTimeJ StopTimeJ -5 StartTimeJ StopTimeJ -6 StartTimeJ StopTimeJ 

      The -0 is Sunday
      -1 Monday
      etc…
      and each couple of StartTimeJ and StopTimeJ is :
      – StartTimeJ : the Hour in second since Midnight
      – StopTimeJ is a duration in second.
      This two value is get with New-TimeSpan.

      So What i want to do is to calculate the value of each StartTime end StopTime !
      For this i need :
      – The Date and hour of begining
      – The date and hour of the duration
      – The date of Ending backup

      after i’m using the command line Get date to now the day of begining
      Use New-TimeSpan to have the time in second and difference between startTime and stopTime to have the value in second of StopTime
      I need to have the numebr of days between the start and Ending to create the while.

      The error i see :
      The format (%d/%m/%Y %H:%M) change to (%m/%d/%Y %H:%M) and the AddDays don’t works normally, the result i wait is :

      DiffJour: 3
      #######################
      0
      Avant-AddDays: 01/02/2020 16:00
       
      ApresAddDays-Start: 01/02/2020 16:00
       
      #######################
      1
      Avant-AddDays: 01/02/2020 16:00:00
       
      ApresAddDays-Start: 02/02/2020 16:00:00
       
      #######################
      2
      Avant-AddDays: 02/02/2020 16:00:00
       
      ApresAddDays-Start: 03/02/2020 16:00:00
       
      #######################
      3
      Avant-AddDays: 03/02/2020 16:00:00
       
      ApresAddDays-Start: 04/02/2020 16:00:00
      

      It’s complicate to explain, i hope i make me understand to you.

      PS: what is the Format for Code ? i use PRE but you seem to say i don’t use the good format.
      I try the CODE format but nothing change.

      • This reply was modified 1 month, 3 weeks ago by Renaud.
      • This reply was modified 1 month, 3 weeks ago by Renaud.
      • This reply was modified 1 month, 3 weeks ago by Renaud.
      • This reply was modified 1 month, 3 weeks ago by Renaud.
    • #216915
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      PS: what is the Format for Code ? i use PRE but you seem to say i don’t use the good format.

      No no, that’s jsut perfect. I meant when you post error messages you should format them the same way as you do with code, that’s all. 😉

    • #216921
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      I have add in the precedent message : what i’m waiting as result.
      We don’t see any error line, but the result is not good !

      • This reply was modified 1 month, 3 weeks ago by Renaud.
      • This reply was modified 1 month, 3 weeks ago by Renaud.
    • #216933
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      Ah … now I see what you mean. If you want to force a [DateTime] to have a specific format you just have to tell it …. 😉

      (Get-Date).AddDays(5).ToString('dd/MM/yyyy HH:mm')

      You could go even really fancy like this if you want:

      $Date = (Get-Date).AddHours(18)
      "{0:00}~{1:00}~{2:0000} {3:00}-Ξ-{4:00}" -f $Date.Day,$Date.Month,$Date.Year,$Date.Hour,$Date.Minute

      This way you have complete control over the output.

    • #216942
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      OKKKKKKkkkkkk !!!!
      Oh you are such good !!

      Please give me your skills :p

      But for the second way….Heu don’t understand….

    • #216945
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Ok so i just have tried, buit there is another problems…
      Script:

      $Start = "01/02/2020 16:00"
      $Stop = "02/02/2020 06:00"
      $StopHebdo = "05/02/2020 06:00"
      $JourDiff = (New-TimeSpan -start $Start -End $StopHebdo).Days
      Write-Host "DiffJour: $JourDiff"
      $i = 0
      $StartTimeJ = @()
      $StopTimeJ = @()
      
      #Gros problème de format de date lors du New-TimeSpan !
      While($i -le $jourDiff){
          Write-Host "#######################"
          Write-Host "$i"
          Write-Host "Avant-AddDays: $Start"
          #Write-Host "Avant-Stop: $Stop"
          Write-Host " " 
          #[Datetime]$Start = $Start
          $DateStart = (Get-Date  -Date $Start).AddDays($i).ToString("dd/MM/yyyy HH:mm") 
          Write-Host "ApresAddDays-Start: $Start"
          [string]$DateStop = (Get-Date $Stop).AddDays($i)
          #Write-Host "ApresAddDays-Stop: $Stop"
          Write-Host " " 
          [String]$Start = $DateStart
          $StartTimeJ += (New-TimeSpan -Start ($DateStart.Split(" ")[0]) -End $DateStart).TotalSeconds 
          $StopTimeJ += (New-TimeSpan -Start $DateStart -End $DateStop).TotalSeconds
          $i++
      }

      Result:

      DiffJour: 3
      #######################
      0
      Avant-AddDays: 01/02/2020 16:00
       
      ApresAddDays-Start: 01/02/2020 16:00
       
      #######################
      1
      Avant-AddDays: 01/02/2020 16:00
       
      ApresAddDays-Start: 01/02/2020 16:00
       
      #######################
      2
      Avant-AddDays: 02/02/2020 16:00
       
      ApresAddDays-Start: 02/02/2020 16:00
       
      #######################
      3
      Avant-AddDays: 04/02/2020 16:00
       
      ApresAddDays-Start: 04/02/2020 16:00

      The Days 0:
      – Nothing change, normal.
      The Days 1:
      – Before the command line , same, but after command line same ?! normally the result would be : 02/02/2020 ! No ?
      The Days 2:
      – One Days have been add, normally it would be 2 Days.

      The 3 Day:
      – The date change of 2 days in a time??

      Am i wrong or there is something weird ?

    • #216948
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      But for the second way….Heu don’t understand….

      about_Operators Format operator -f

      How-to: The -f Format operator

    • #216951
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      …. Am i wrong or there is something weird ?

      Sorry, I still did not get what you actually trying to calculate. Could you please provide a complete example command line like you would expect it? So not with the variables like this:

      .\bpplscedwin -0 StartTimeJ StopTimeJ -1 StartTimeJ StopTimeJ -2 StartTimeJ StopTimeJ -3 StartTimeJ StopTimeJ -4 StartTimeJ StopTimeJ -5 StartTimeJ StopTimeJ -6 StartTimeJ StopTimeJ 

      Instead with the real values you would use on a command line.

      Thanks in advance.

    • #216978
      Participant
      Topics: 12
      Replies: 524
      Points: 1,220
      Helping Hand
      Rank: Community Hero

      Going back to the script .\bpplscedwin, I would update it to accept the backup schedule as an array of Hash Tables, one Hash Table for each of the 7 days of the week as in:

      function Some-function {
      
          [CmdletBinding(ConfirmImpact='Low')] 
          Param(
              [Parameter(Mandatory=$false)][HashTable[]]$BackupSchedule = @(
                  @{ DayOfWeek = 'Sunday';    StartTime = '16:00'; EndTime = '6:00' },
                  @{ DayOfWeek = 'Monday';    StartTime = '16:00'; EndTime = '6:00' },
                  @{ DayOfWeek = 'Tuesday';   StartTime = '16:00'; EndTime = '6:00' },
                  @{ DayOfWeek = 'Wednesday'; StartTime = '16:00'; EndTime = '6:00' },
                  @{ DayOfWeek = 'Thursday';  StartTime = '16:00'; EndTime = '6:00' },
                  @{ DayOfWeek = 'Friday';    StartTime = '16:00'; EndTime = '6:00' },
                  @{ DayOfWeek = 'Saturday';  StartTime = '16:00'; EndTime = '6:00' }
              )
          )
      
          Begin { }
      
          Process { 
              foreach ($Day in $BackupSchedule) {
                  "Backup Schedule for '$($Day.DayOfWeek)' is '$($Day.StartTime) to $($Day.EndTime)'"
              }
          }
      
          End { }
      
      }
      

      So that when passing the input to the script/function, it’s easily understandable by other people such as:

      Some-function -BackupSchedule @(
          @{ DayOfWeek = 'Sunday';    StartTime = '16:00'; EndTime = '6:00' },
          @{ DayOfWeek = 'Monday';    StartTime = '17:00'; EndTime = '6:00' },
          @{ DayOfWeek = 'Tuesday';   StartTime = '18:00'; EndTime = '6:00' },
          @{ DayOfWeek = 'Wednesday'; StartTime = '14:00'; EndTime = '6:00' },
          @{ DayOfWeek = 'Thursday';  StartTime = '15:00'; EndTime = '6:00' },
          @{ DayOfWeek = 'Friday';    StartTime = '12:00'; EndTime = '6:00' },
          @{ DayOfWeek = 'Saturday';  StartTime = '11:00'; EndTime = '6:00' }
      )
      Backup Schedule for 'Sunday' is '16:00 to 6:00'
      Backup Schedule for 'Monday' is '17:00 to 6:00'
      Backup Schedule for 'Tuesday' is '18:00 to 6:00'
      Backup Schedule for 'Wednesday' is '14:00 to 6:00'
      Backup Schedule for 'Thursday' is '15:00 to 6:00'
      Backup Schedule for 'Friday' is '12:00 to 6:00'
      Backup Schedule for 'Saturday' is '11:00 to 6:00'
      

      Can you share .\bpplscedwin ?

    • #216981
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Hello Sam,

       

      What do you mean about sharing bpplshedwin ?

       

    • #216984
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      The command line is :

       

       

      .\bpplschedwin $PolicyName $ScheduleLabel -0 0 0 -1 0 0 -2 0 0 -3 0 0 -4 0 0 -5 0 0 -6 0 0"
      
    • #216987
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP
    • #216990
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      To reply to OLaf:

      When we launche the script we ask :
      Date and hour of start
      Date and hour of end the next days
      Date and hour of the ending of the week.

      We will take a Week like:
      Lundi – Mardi
      03/02/2020 16:00
      04/02/2020 06:00

      Mardi – Mercredi
      04/02/2020 16:00
      05/02/2020 06:00

      Mercredi – Jeudi
      05/02/2020 16:00
      06/02/2020 06:00

      Jeudi – Vendredi
      06/02/2020 16:00
      07/02/2020 06:00

      Calcul of StartTime :

      $Jour = (Get-Date -Date $Start.split(" ")[0] -UFormat "%A").Replace(" ","")
      $StartTime = (New-TimeSpan -Start ($Start.Split(" ")[0]) -End $Start).TotalSeconds
      => 57600 (s)
      

      Calcul of StopTime:

      $StopTimeJ = (New-TimeSpan -Start $Start -End $Global:Stop).TotalSeconds
      => 50400 (s)
      

      at the end the command must be like that :

      .\bpplschedwin $PolicyName $ScheduleLabel -0 0 0 -1 57600 50400 -2 57600 50400 -3 57600 50400 -4 57600 50400 -5 0 0 -6 0 0
      

      For this command the variable $StartTime and $StopTime are an Array.
      And we calculate the number of day between the start and the end of week.

    • #216996
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Sam, the problem i see with your way, is we must fill the Hour of StartTime and StopTime each days.
      I need this will be calculate by the script not by the user ending.

      What do you think about this Sam ?

      • This reply was modified 1 month, 3 weeks ago by Renaud.
    • #217005
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      But what for would you need the actual date. bpplschedwin takes only the day of the week anyway. There’s no representation for the 9th of April 2020 – it’s Thursday. So it’s “-4”.
      So a complete work week with the start at 16:00 and the end at 06:00 the next day would be this:

      .\bpplschedwin $PolicyName $ScheduleLabel -0 57600 50400 -1 57600 50400 -2 57600 50400 -3 57600 50400 -4 57600 50400 -5 0 0 -6 0 0
    • #217023
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      I have just try something more simple (for me), to see the result of the AddDays :

      $Start = "03/02/2020 16:00"
      $StartTime = ""
      $i = 0
      While($i -le 5){
          Write-Host ""
          Write-Host "Value of i : $i"
          Write-Host "StartTime - before AddDays: $StartTime"
          $StartTime = (Get-Date $Start).AddDays($i).ToString("dd/mm/yyyy HH:mm")
          Write-Host "StartTime - After AddDays: $StartTime"
          #$StartTime = (New-TimeSpan -Start $Start -End)
          $i++
      }
      

      Result:

      Value of i : 0
      StartTime - before AddDays: 
      StartTime - After AddDays: 03/00/2020 16:00
      
      Value of i : 1
      StartTime - before AddDays: 03/00/2020 16:00
      StartTime - After AddDays: 04/00/2020 16:00
      
      Value of i : 2
      StartTime - before AddDays: 04/00/2020 16:00
      StartTime - After AddDays: 05/00/2020 16:00
      
      Value of i : 3
      StartTime - before AddDays: 05/00/2020 16:00
      StartTime - After AddDays: 06/00/2020 16:00
      
      Value of i : 4
      StartTime - before AddDays: 06/00/2020 16:00
      StartTime - After AddDays: 07/00/2020 16:00
      
      Value of i : 5
      StartTime - before AddDays: 07/00/2020 16:00
      StartTime - After AddDays: 08/00/2020 16:00

      Ok…..Now i’m Crazy !

      The Add is pretty good ! but..the month change to 00 ??
      Tell me the bug is in my head.

    • #217029
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Oh i don’t see you have reply.

      I need to actual date because, for example when we have a maintenance the week End and we could not done a full backup, we want to make possible to do an Incremental during this maintenance Week-End.

    • #217044
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Ok i’v found the reason of the error, it’s because the format in the ToString, is not good.

      I’ just put mm instead MM as you said to me in the ToString format.

      • This reply was modified 1 month, 3 weeks ago by Renaud.
    • #217059
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      I’ just put mm instead MM as you said to me in the ToString format.

      “mm” stand’s for minutes
      “MM” stand’s for month

    • #217089
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Ok i’ ve found for the date, it’s a bad mistake !

      After looking this script :

       

       [String]$Start = $DateStart
          $StartTimeJ += (New-TimeSpan -Start ($DateStart.Split(" ")[0]) -End $DateStart).TotalSeconds 
          $StopTimeJ += (New-TimeSpan -Start $DateStart -End $DateStop).TotalSeconds

      The Variable is not using correctly there is a melting pot with this variable ($Start and $DateStart and $DateStop)
      Now it’s ok :

      $Start = "03/02/2020 16:00"
      $Stop = "04/02/2020 06:00"
      $StopHebdo = "07/02/2020 06:00"
      $StartTimeJ = @()
      $StopTimeJ = @()
      $NbJourDiff = (New-TimeSpan -start $Start -End $StopHebdo).Days
      Write-Host "DiffJour: $JourDiff"
      $StartTime= ""
      $i = 0
      While($i -le $NbJourDiff){
          Write-Host ""
          Write-Host "Value of i : $i"
          Write-Host "StartTime - before AddDays: $StartTime"
          $StartTime = (Get-Date $Start).AddDays($i).ToString('dd/MM/yyyy HH:mm')
          $StopTime = (Get-Date $Stop).AddDays($i).ToString("dd/MM/yyyy HH:mm")
          Write-Host "StartTime - After AddDays: $StartTime"
          Write-Host "StopTime - After AddDays: $StopTime"
          Write-Host " " 
          $StartTimeJ += (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds 
          Write-Host "StartTime: $StartTimeJ"
          $StopTimeJ += (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds
          Write-Host "StoptTimeJ: $StopTimeJ"
          $i++
      }

      Result:

      DiffJour: 3
      
      Value of i : 0
      StartTime - before AddDays: 
      StartTime - After AddDays: 03/02/2020 16:00
      StopTime - After AddDays: 04/02/2020 06:00
       
      StartTime: 57600
      StoptTimeJ: 50400
      
      Value of i : 1
      StartTime - before AddDays: 03/02/2020 16:00
      StartTime - After AddDays: 04/02/2020 16:00
      StopTime - After AddDays: 05/02/2020 06:00
       
      StartTime: 57600 57600
      StoptTimeJ: 50400 50400
      
      Value of i : 2
      StartTime - before AddDays: 04/02/2020 16:00
      StartTime - After AddDays: 05/02/2020 16:00
      StopTime - After AddDays: 06/02/2020 06:00
       
      StartTime: 57600 57600 57600
      StoptTimeJ: 50400 50400 50400
      
      Value of i : 3
      StartTime - before AddDays: 05/02/2020 16:00
      StartTime - After AddDays: 06/02/2020 16:00
      StopTime - After AddDays: 07/02/2020 06:00
       
      StartTime: 57600 57600 57600 57600
      StoptTimeJ: 50400 50400 50400 50400

      But if you have advice for another way to do this command i’m listening to you 😉

       

      Anyway Again thx  a lot  Olaf!

      Sam i have note this idea for other things, so thx to you 😉

      • This reply was modified 1 month, 3 weeks ago by Renaud.
    • #217104
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Its so beautifull my script but doesn’t work becayse i have no reference to day….i’m fucked.

      I need to see how to do…

    • #217110
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      OK,just for information, this is the script working good 😉

       

      $Start = "03/02/2020 16:00"
      $Stop = "04/02/2020 06:00"
      $StopHebdo = "07/02/2020 06:00"
      $StartTimeJ = @(" "," "," "," "," "," "," ")
      $StopTimeJ = @(" "," "," "," "," "," "," ")
      $NbJourDiff = (New-TimeSpan -start $Start -End $StopHebdo).Days
      Write-Host "DiffJour: $JourDiff"
      $StartTime= ""
      $i = 0
      
      While($i -le $NbJourDiff){
          Write-Host ""
          Write-Host "Value of i : $i"
          Write-Host "StartTime - before AddDays: $StartTime"
          $StartTime = (Get-Date $Start).AddDays($i).ToString('dd/MM/yyyy HH:mm')
          $JourStartTime = (Get-Date $StartTime).DayOfWeek
          Write-Host "DaysofWeek: $JourStartTime"
          Switch($JourStartTime){
              Sunday{$StartTimeJ[0] += (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
              Monday{$StartTimeJ[1] += (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
              Tuesday{$StartTimeJ[2] += (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
              Wednesday{$StartTimeJ[3] += (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
              Thursday{$StartTimeJ[4] += (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
              Friday{$StartTimeJ[5] += (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
              Saturday{$StartTimeJ[6] += (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}    
          }
          $StopTime = (Get-Date $Stop).AddDays($i).ToString("dd/MM/yyyy HH:mm")
          $JourStopTime = (Get-Date $StopTime).DayOfWeek
          Switch($JourStopTime){
              Sunday{$StopTimeJ[0] += (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
              Monday{$StopTimeJ[1] += (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
              Tuesday{$StopTimeJ[2] += (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
              Wednesday{$StopTimeJ[3] += (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
              Thursday{$StopTimeJ[4] += (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
              Friday{$StopTimeJ[5] += (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
              Saturday{$StopTimeJ[6] += (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}    
          }
          Write-Host "StartTime - After AddDays: $StartTime"
          Write-Host "StopTime - After AddDays: $StopTime"
          Write-Host " " 
          Write-Host "StartTimeJ: $StartTimeJ"
          Write-Host "StoptTimeJ: $StopTimeJ"
          $i++
      }
      

      Have a good evening you both 😉

    • #217116
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      No does’nt work…

    • #217119
      Participant
      Topics: 8
      Replies: 50
      Points: 111
      Rank: Participant

      Yes yes it’s work 😉

      See you 😉

Viewing 25 reply threads
  • You must be logged in to reply to this topic.