Adding Timestamp Into The Form Data By Using Javascript

I am trying to develop an addon.

part of php:

 $objects = array_values(array_map(function ($category) use ($view, $company_id) {
            $view->assign('category', $category);
	return array(
                'id' => $category['id'],
                'text' => $category['name'],

    }, $categories));
    Tygh::$app['ajax']->assign('objects', $objects);

part of TPL file:


{include file=“buttons/save_cancel.tpl” but_text=__(“save”) but_meta=“cm-product-save-buttons” but_role=“submit-link” but_name=“dispatch[cce_paket_yonetimi.update]” but_target_form=“paket_form” save=$id}

I import some values trough array map in php and show them in ajax select option in form. Then I post selected values.

I want to add an extra field that adds currently timestamp when a value selected, at the time when mouse clicked/selected a value and post that timestampo field with selected ids in array.

Like this:

    [category] => Array
            [id] => 13,
            [timestamp_added] => 1559380913


I am not mentioning the timestamp that values will be posted into the database, I mean timestamp that items will be selected. becuse each tiem is going to be selected in different time when by clicking mouse. I need to add its timestamp when selected for each item added.

How can I do this? I think I need to add timestamo using JS.

I will be very glad if you help by writing example codes or guide with your any idea.

Anyone who can help? :)