question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non-uniform timestamp format between querying and writing

See original GitHub issue

I was trying to use queryRaw to do some data migration, and found that a point retrieved via .queryRaw isn’t easily passed to .writePoint.

queryRaw (and query as well) pass through the JSON returned by Influx, which serializes dates into RFC3339 strings.

The problem is that .writePoints expects a Date object or a UNIX time.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dandvcommented, Oct 7, 2016

Also good to know about the time format in responses, since this may help optimize parsing:

Everything in InfluxDB is stored and reported in UTC. By default, timestamps are returned in RFC3339 UTC and have nanosecond precision, for example 2015-08-04T19:05:14.318570484Z. If you want timestamps in Unix epoch format include in your request the query string parameter epoch where epoch=[h,m,s,ms,u,ns]. For example, get epoch in seconds with:

curl -G 'http://localhost:8086/query' --data-urlencode "db=mydb" --data-urlencode "epoch=s" --data-urlencode "q=SELECT \"value\" FROM \"cpu_load_short\" WHERE \"region\"='us-west'"

Some libraries (e.g. HighCharts) require timestamps in UNIX format, so no parsing would be required.

1reaction
dandvcommented, Oct 7, 2016

Some docs on the (non)idempotence of timestamps would be useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Date/Time Types | Pivotal Greenplum Docs
When a timestamp with time zone value is output, it is always converted from UTC to the current timezone zone, and displayed as...
Read more >
SQL - DATE and TIME Functions - The Data School
DATE and TIME values in PostgreSQL have a whole special set of functions and operators for their proper use. Learn how to use...
Read more >
SQL DATE – Function, Query, Timestamp Example Format
It returns the date in the YYYY-MM-DD format. For instance, SELECT CURRENT_DATE() returns the date I started writing this article:
Read more >
Exploring Postgres date formats and their different functions
In this article, we will explore Postgres dates, the different date data types, uses and functions. Date and timestamps are helpful for data ......
Read more >
SQL Date Format | Advanced SQL - Mode Analytics
You might think that converting these values from string to date might solve the problem, but it's actually not quite so simple. Mode...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found