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

104
Views
secuencia de comandos de la aplicación agregar bucle por marca de tiempo agregando 30 días para cada bucle

Tengo un código de script en el script de la aplicación, este script devuelve datos de la API como JSON.

La API de entrada tiene dos parámetros: primero y segundo. este parámetro es la marca de tiempo.

el primero es la marca de tiempo y el segundo es la marca de tiempo.

API solo toma 30 días entre la primera fecha y la segunda, si agregar 31 no funciona.

Este es mi código:

 function script() { // Current date. const current_date = new Date()//.valueOf(); Logger.log(current_date) var timestamp = Number(current_date).toFixed(0); Logger.log(timestamp) // manual date const inputdate = new Date('01, 17, 2022')//.valueOf(); Logger.log(inputdate) var timestampp = Number(inputdate).toFixed(0); Logger.log(timestampp) // this add 30 days in inputdate var newdate = inputdate.setDate(inputdate.getDate()+30); // Convert Date To Timstamp var timestamp2 = Number(newdate).toFixed(0); Logger.log(timestamp2) // I want to use loop by change date for every loop add 30 days and stooped if date = current_date const data = [] // push arrays from obj return json const host = "****" const res = UrlFetchApp.fetch(host + "?first="+ timestampp +"&second="+timestamp2); const obj = JSON.parse(res); // To JSON Logger.log(obj); }

Ejemplo:

primer bucle: utilice "?primero="+ 01, 17, 2022 +"&segundo="+ 02, 16, 2022

uso del segundo bucle: "?primero="+ 02, 17, 2022 +"&segundo="+ 03, 19, 2022

Uso del tercer ciclo: "?primero="+ 03, 20, 2022 +"&segundo="+04, 19, 2022

y mantenga la ejecución del bucle, obtenga json obj y agréguelo en la matriz de datos.

detener el bucle si la última fecha> fecha_actual.

about 4 years ago · Juan Pablo Isaza
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!