vendredi 3 juillet 2015

how to use if / else

I am a google script beginner and i need some help ! I have a script importing data in a file and I want to add a condition on the date.

My script below:

obj.participants[i].create_date.replace(/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})/, function(p, year, mon, day, hour, min) {
                data[index][3] = [day, mon, year - 2000].join("/");
                data[index][4] = [hour, min].join("h");
            });
billet = obj.participants[i].id_weez_ticket;
data[index][31] = 15+billet.substring(0,4);

I want to change the last line depending on the date value in data[index][4]:

  • if data[index][4] < 1/09/2015 then data[index][31] = 15+billet.substring(0,4)
  • else data[index][31] = 16+billet.substring(0,4);

Thank you for your help !

Aucun commentaire:

Enregistrer un commentaire