Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

111
Views
Cómo repetir el evento cada 2 semanas en días de selección múltiple hasta 3 Ocurrencias

Estoy trabajando en un tipo de función de repetición del calendario de Google usando angularjs/php. ingrese la descripción de la imagen aquí

Intente repetir el evento cada 2 semanas en una selección múltiple de días y ese evento se repetirá hasta 3 veces (veces) desde la fecha de inicio. PFA mi código.

 $scope.daysarr = [{dayname: "SUN",Name: 'Sunday', Selected: true}, {dayname: "MON",Name: 'Monday', Selected: false}, {dayname: "TUE",Name: 'Tuesday', Selected: true}, {dayname: "WED",Name: 'Wednesday', Selected: false}, {dayname: "THU",Name: 'Thursday', Selected: true}, {dayname: "FRI",Name: 'Friday', Selected: false}, {dayname: "SAT",Name: 'Saturday', Selected: false}]; for ($i=1; $i<=$after_occurance ; $i++) { // 3times if($i==1) { $datesArr[] = $date->format('Ym-d'); } else { echo $dayOfWeek = $date->format('l'); if ($dayOfWeek == 'Sunday' && $daysarr[0]->selected==1) { // i want to loop sun,tue,thu $date->modify("+{$repeatnum} weeks"); // 2 weeks $datesArr[] = $date->format('Ym-d'); } if ($dayOfWeek == 'Tuesday' && $daysarr[2]->selected==1) { // i want to loop sun,tue,thu $date->modify("+{$repeatnum} weeks"); // 2 weeks $datesArr[] = $date->format('Ym-d'); } if ($dayOfWeek == 'Thursday' && $daysarr[4]->selected==1) { // i want to loop sun,tue,thu $date->modify("+{$repeatnum} weeks"); // 2 weeks $datesArr[] = $date->format('Ym-d'); } }}

Obtener la salida solo la fecha de inicio seleccionada en repetición en lugar de los días seleccionados

Rendimiento esperado:

dom: 09-ene-2022, 23-ene-2022, 06-feb-2022

mar: 04-ene-2022, 18-ene-2022, 01-feb-2022

jue: 06-ene-2022, 20-ene-2022, 03-feb-2022

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Lo haría usando segundos según la fecha de inicio proporcionada convertida a EPOCH:

 <?php // convert startDate input to epoch time $startDate = strtotime($_POST['startDate']); // how many seconds does 2 weeks contain? $interval = 2 * 7 * 24 * 60 * 60; // calculate and display the startDate, followed by its next ocurrences for ($i=0; $i<$after_occurance; $i++) { // 3times if ($i == 0) { // output the first date with the Day name echo date("D, dmY", ($startDate + ($i * $interval))); } else { // all other dates won't display the day name echo date("dmY", ($startDate + ($i * $interval))); } // if not last, add a comma and a space to the output if ($i < $after_occurance-1) { echo ', '; } else { echo '<br/>'; } }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!