64

I am new to InfluxDB. I am querying data in admin ui. I see time as timestamp. Is it possible to see it formatted as date and time?

PolinaC
  • 641
  • 1
  • 5
  • 3
  • Can you define what you mean by "timestamp"? The admin UI in InfluxDB 0.9.1 and above returns times in a format like this: `2015-07-17T20:32:58.662703915Z`, where `2015-07-17` is the year-month-day, and `20:32:58.662703915` is hour:minute:second:nanoseconds. I would call that a timestamp AND formatted by date and time. – beckettsean Jul 28 '15 at 23:31
  • 1
    I have a similar question and in my case, I'm running queries from the `influx` CLI shell and times are printed as Unix epoch nanoseconds. I'd rather see RFC 3339 formatting, like the HTTP API does by default. – asciiphil Dec 27 '15 at 22:41
  • The Admin UI has limited functionality and is not recommended for production use. The answer from "thierry" is correct, use the CLI and you can control the timestamp format and precision. – beckettsean Jan 05 '16 at 23:53

4 Answers4

124

You can select RFC 3339 formatting by entering the following command in the CLI:

precision rfc3339
steakunderscore
  • 1,007
  • 9
  • 16
thierry
  • 1,241
  • 1
  • 8
  • 4
21

To convert influxdb timestamp to normal timestamp you can type on console:

influx -precision rfc3339

Now try with your query it should work.

For more details follow link : https://www.influxdata.com/blog/tldr-influxdb-tech-tips-august-4-2016/

Viraj Wadate
  • 2,873
  • 20
  • 25
  • I added it as an alias. I think it should be default option only for the influx cli. – Konrad May 17 '19 at 09:50
  • No by default you will get influxdb timestamp which is like `1465839830100400200` after using RFC3339 format you will get `2016-06-13T17:43:50.1004002Z` – Viraj Wadate May 18 '19 at 10:25
15

Although thierry answered the question already, here is the link to the documentation as well:

precision 'rfc3339|h|m|s|ms|u|ns'

Specifies the format/precision of the timestamp: rfc3339 (YYYY-MM-DDTHH:MM:SS.nnnnnnnnnZ), h (hours), m (minutes), s (seconds), ms (milliseconds), u (microseconds), ns (nanoseconds). Precision defaults to nanoseconds.

https://docs.influxdata.com/influxdb/v1.5/tools/shell/#influx-arguments

Community
  • 1
  • 1
Tobias
  • 6,533
  • 5
  • 59
  • 82
8

The Web Admin Interface was deprecated as of InfluxDB 1.1 (disabled by default).

The precision of the timestamp can be controlled to return hours (h), minutes (m), seconds (s), milliseconds (ms), microseconds (u) or nanoseconds (ns). A special precision option is RFC3339 which returns the timestamp in RFC3339 format with nanosecond precision. The mechanism for specifying the desired time precision is different for the CLI and HTTP API.

To set the precision in CLI, you write precision <RFC3339|h|m|s|ms|us|ns> in the command line depending on what precision you want. The default value of the precision for the CLI is nanoseconds.

To set the precision in HTTP API, you pass epoch=<h|m|s|ms|us|ns> as a query parameter. The default value of the precision is RFC3339.

Mark Amery
  • 110,735
  • 57
  • 354
  • 402
Demetris
  • 2,139
  • 1
  • 20
  • 29