Adding a milliseconds to a variable everytime a button is pressed

Could anyone please tell me how i can add milliseconds to my variable “time” everytime a button is pressed?

//Linkerknop hoort bij linkerledje en andersom,
//dus wanneer je de linkerknop indrukt, gaat het linkerledje uit en
//het rechter ledje branden

const int ledPinRechts7 = 7; //nummers van rechter ledjes
const int ledPinRechts8 = 8;
const int ledPinRechts9 = 9;

const int ledPinLinks11 = 11; //nummers van linker ledjes
const int ledPinLinks12 = 12;
const int ledPinLinks13 = 13;

const int knopLinks = 3; //nummer van pin linker knop
const int knopRechts = 2; //nummer van pin rechter knop

int statusKnopLinks = LOW; //uitlezen status linker knop
int statusKnopRechts = LOW;
int ledState = LOW;//uitlezen status rechter knop

long previousMillis = 0;
long interval;
long tijd = 15000;

int i;

int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by

void setup() {
// put your setup code here, to run once:


//linker Ledjes benoemen als output
pinMode(ledPinLinks11, OUTPUT);
pinMode(ledPinLinks12, OUTPUT);
pinMode(ledPinLinks13, OUTPUT);

//Rechter Ledjes benoemen als output
pinMode(ledPinRechts7, OUTPUT);
pinMode(ledPinRechts8, OUTPUT);
pinMode(ledPinRechts9, OUTPUT);

//Knoppen benoemen als input
pinMode(knopLinks, INPUT);
pinMode(knopRechts, INPUT);


void loop()
// put your main code here, to run repeatedly:

//statussen uitlezen van beide knoppen
statusKnopLinks = digitalRead(knopLinks);
statusKnopRechts = digitalRead(knopRechts);

if(statusKnopLinks == HIGH && statusKnopRechts == LOW){

digitalWrite(ledPinLinks11, LOW);
digitalWrite(ledPinLinks12, LOW);
digitalWrite(ledPinLinks13, LOW);

digitalWrite(ledPinRechts7, HIGH);
digitalWrite(ledPinRechts8, HIGH);
digitalWrite(ledPinRechts9, HIGH);;

} else if(statusKnopRechts == HIGH && statusKnopLinks == LOW){

digitalWrite(ledPinRechts7, LOW);
digitalWrite(ledPinRechts8, LOW);
digitalWrite(ledPinRechts9, LOW);

digitalWrite(ledPinLinks11, HIGH);
digitalWrite(ledPinLinks12, HIGH);
digitalWrite(ledPinLinks13, HIGH);


/*for(i; i < 1; i++){


if(i == 1){
long currentMillis = millis();
long interval = 1000;

if(currentMillis - previousMillis >= interval){
// save the last time you blinked the LED
previousMillis = currentMillis;

// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
// set the LED with the ledState of the variable:
digitalWrite(ledPinLinks11, ledState);



if(millis() >= tijd ){



void ledToggle() {
ledState = (ledState == HIGH) ? LOW : HIGH;
digitalWrite(ledPinLinks11, ledState);

how i can add milliseconds to my variable "time" everytime a button is pressed?

I have not looked at your code in detail but from your question it seems that you want to do something every time a button becomes pressed as opposed to doing something while the button is pressed.

Have a look at the StateChangeDetection example in the IDE to see how to do this.