Kibana Lens Table Date Format

Hi, using a table in Kibana Lens I can't get a formatted date at the "Log Date" column. The date format changes according to the time period. Below is the JSON I've been using and the screenshots with the issue

{
"took": 40,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1.9924302,
"hits": [
{
"_index": "ff_sms",
"_type": "_doc",
"_id": "60df32454534910028e35459",
"_score": 1.9924302,
"_source": {
"type": "prueba",
"sentBySistarBank": false,
"deliveryReport": false,
"canceled": false,
"irisIxId": "60df32454534910028e35454",
"client": "test_iris",
"app": "postman",
"cellNumber": 59892300727,
"text": "prioridad 1",
"creationDate": "2021-07-02T15:35:33.458Z",
"priority": 1,
"log": [
{
"error": false,
"date": "2021-07-02T15:35:33.458Z",
"step": "recibidoAPI"
},
{
"error": false,
"date": "2021-07-02T15:35:33.848Z",
"step": "agregadoKafka"
}
],
"__v": 1
}
}
]
}
}

Hi @fefontana ,

That setting in the Lens panel can configure how fine the date bucket/histogram should be, and not the date formatter.

At the moment there's not specific Lens option to format that date, rather a Kibana-wise option available in Advanced Settings named dateFormat:scaled where you can specify how dates should be formatted:

There's a Lens issue about contextual formatting which aims to address also this type of problem: https://github.com/elastic/kibana/issues/93265

Hi @fefontana @Marco_Liberati

I Stand Corrected! This does not appear to work for Lens Table (works most everywhere else, I am surprised)

@fefontana Apologies for the confusion, it is a good trick to know though

There is another method to do this... Set the date format pattern for that field in its index pattern, and that will only affect the display for that field wherever it is used.

Thank you, Marco for your answer.
I changed in "Advanced Options" the date format mask (to DD-MM-YYYY HH:mm:ss) and the date column shows the correct format, but not the correct value. If you take a look at the JSON, the first two rows shows wrong minutes and seconds, ie., 02-07-2021 12:00:00 (-03:00 GMT) is not equal to 2021-07-02T15:35:33.458Z. Take a look at the image below:

Any comment will be appreciated

Thank you Stephen for your response.
I also changed the date format at the pattern field, but the result is the same as the screen at the previous post, no change.

The only way I found to get the right date vale was to create a scripted field like the image below:

1 Like

Good to Know!
You could (should) probably use a runtime field too.. (the future of scripted fields) you can add right from the index pattern as well.