====== Zabbix - Preprocessing ====== ===== Cookbook ===== ==== ISO8601 to unixtime ==== ^Input^Output^ |2024-07-04T13:03:44.624+00:00|1720098224| |2024-08-18T19:44:47+02:00|1724003087| |2024-08-18 19:48:06|1724010486| |2024-08-18|1723939200| Supported [[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format|Date time string format]] for input. const date = new Date(value); const epoch = Math.floor(date.getTime()/1000); return(epoch); Type of information: Numeric (unsigned) Units: unixtime [[https://duktape.org/dukweb.html#function%20preprocessing(value)%20%7B%0A%20%20%20%20const%20date%20%3D%20new%20Date(value)%3B%0A%20%20%20%20const%20timestampSeconds%20%3D%20Math.floor(date.getTime()%20%2F%201000)%3B%0A%20%20%20%20return(timestampSeconds)%3B%0A%7D%0A%0Aconst%20value%3D%222024-08-18T19%3A44%3A47%2B02%3A00%22%3B%0Aconsole.log(preprocessing(value))%3B|Dukweb.js Example]] ===== Links ===== * [[https://www.zabbix.com/documentation/current/en/manual/config/items/preprocessing|Item value preprocessing]] * [[https://duktape.org/dukweb.html|Dukweb.js test]] * [[https://duktape.org/dukweb.html#function%20preprocessing(value)%20%7B%0A%20%20%20%20%2F%2F%20your%20code%20here%0A%7D%0A%0Aconst%20value%3D%22%22%3B%20%2F%2F%20define%20your%20input%20value%0Aconsole.log(preprocessing(value))%3B|Dukweb.js Empty Template]]