Can I get daily interval results for a timezone instead of UTC?

206 views
Skip to first unread message

Mark Gibson

unread,
Oct 13, 2014, 1:36:26 PM10/13/14
to keen-i...@googlegroups.com

I'm doing a query to obtain a daily count specified by an absolute timeframe.  I'd like the daily timeframe to give me the count based on US/Eastern with the proper offset, but the results are given in UTC.

EDIT:  The documentation states the following:

If you use an absolute timeframe, we use the timezone in the ISO-8601 strings to define the timezone instead of the timezone parameter.

so I appear to be out of luck.  But this sure would be a useful (and reasonable) feature.

Here are the results from the workbench.  Note that in the timeframe for each day should start and end at "T04:00:00.000Z" to correspond to US/Eastern. The 'start' on the first day and 'end' on the last day correctly reflect the timeframe in the query given as

 { "start": "2014-08-31T04:00:00.000Z", "end":"2014-09-02T04:00:00.000Z" }



{
  "result": [
    {
      "value": [
        {
          "eventType": "foo",
          "result": 134
        },
        {
          "eventType": "bar",
          "result": 504
        }
      ],
      "timeframe": {
        "start": "2014-08-31T04:00:00.000Z",
        "end": "2014-09-01T00:00:00.000Z"
      }
    },
    {
      "value": [
        {
          "eventType": "foo",
          "result": 138
        },
        {
          "eventType": "bar",
          "result": 490
        }
      ],
      "timeframe": {
        "start": "2014-09-01T00:00:00.000Z",
        "end": "2014-09-02T00:00:00.000Z"
      }
    },
    {
      "value": [
        {
          "eventType": "foo",
          "result": 16
        },
        {
          "eventType": "bar",
          "result": 80
        }
      ],
      "timeframe": {
        "start": "2014-09-02T00:00:00.000Z",
        "end": "2014-09-02T04:00:00.000Z"
      }
    }
  ]
}

I've reproduced the same result using the workbench, the 'Query Url' produced by the workbench and using the javascript api.  I've tried setting the timezone to 'US/Eastern' and '-14400'.  Is this a bug or am I missing something?

Thanks!

Daniel Kador

unread,
Oct 13, 2014, 1:48:20 PM10/13/14
to Mark Gibson, Keen IO Developers
Hi Mark,

The workaround is to put the ISO8601 strings in your absolute timeframe into the timezone you want to use. So try setting your timeframe to:

{ "start": "2014-08-31T00:00:00.000-04:00", "end":"2014-09-02T00:00:00.000-04:00" }

Hope that helps!

-Dan

Mark Gibson

unread,
Oct 13, 2014, 1:57:19 PM10/13/14
to keen-i...@googlegroups.com, ma...@adperk.com
Exactly as stated in the documentation :) 

Thanks!

Mark

Daniel Kador

unread,
Oct 13, 2014, 1:59:33 PM10/13/14
to Mark Gibson, Keen IO Developers
Sometimes it just takes a human to translate the docs. :)
Reply all
Reply to author
Forward
0 new messages