0

I have an object I'm tracking in keen-io that has several date fields. I'd like Keen to preserve these as DateTime fields. This way I can do filtering and sorting.

I'm using a map add adding the dates formated as ISO-8601.

Map<String, Object> o = new HashMap<String, Object>();

o.put("deliveryDate", formatDate(deliveryDate));
o.put("completionDate", formatDate(completionDate));
o.put("assignedDate", formatDate(assignedDate));

Where formatDate looks like:

private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");

protected String formatDate(Calendar date) {
    return dateFormat.format(date.getTime());
}

When the events get to my keen dashboard the field is always treated as a string not a datetime.

Am I missing some step I can not find in the documentation? Are datetime fields available on fields other than keen.timestamp and keen.created_at?

4

1 回答 1

2

可悲的是,日期时间不是当前支持的四种推断数据类型之一(https://keen.io/docs/api/#inferred-data-types)。你是对的,他们现在只支持keen.timestampkeen.created_at。我将有关此用例的有用反馈传递给了 Keen 团队。

一种解决方法是将您的日期时间从纪元转换为秒。这并不理想,但它可以工作。它有一些逻辑,可以帮助您进行查询。当你想显示时间时,你需要转换回一个可读的字符串。

希望这在未来有所改变!

于 2015-08-31T16:19:03.097 回答