2
votes

I am using influx db php client:

https://github.com/influxdata/influxdb-php

I am inserting points in a measurement using php. I am using the function strtotime($date) to get the timestamp in seconds of $date. I have also set the database precision to seconds.

When I query select * from measurementname I can see the timestamp in secods.

For precision rfc3339 I get 2016-08-08T18:30:00Z.

For precision s I get1470681000.

now if i do date('Y-m-d H:s:i',1470681000) in php, the ouptout is 2016-08-09 00:00:00.

I don't undertand why there is a difference in time: 2016-08-08T18:30:00Z and 2016-08-09 00:00:00.

P.S. My timezone is Asia/Kolkata

1
I am getting json 404 error in query. - Abel Jojo

1 Answers

0
votes

The problem is with the php time zone that is being used i.e. Asia/Kolkata,since influxDB stores time in UTC.Changing it to timezone UTC in php script solved the problem.

date_default_timezone_set('UTC')

Above command can be used to change the timezone to UTC.