简体   繁体   English

如何在RediSearch中存储日期/时间

[英]How to store dates/times in RediSearch

I've read that RediSearch has support for dates and times via the "numeric" type, but there's not much information about this. 我已经读过RediSearch通过“数字”类型支持日期和时间,但是没有太多关于此的信息。 Does this mean I just choose my own conversion from time, such as seconds since 1970? 这是否意味着我只是选择自己的时间转换,例如自1970年以来的秒数?

Yep, exactly that (aka epoch and timestamp). 是的,正是那个(又名时代和时间戳)。

You can also define your own epoch and timestamp resolution if you want, like "days since January 1 2018", as long as you convert to and from real times. 您也可以根据需要定义自己的纪元和时间戳分辨率,例如“2018年1月1日以来的天数”,只要您实时转换即可。

Also, the aggregation API has a bunch of functions augmenting dealing with timestamps. 此外,聚合API还有一堆函数可以增加处理时间戳的功能。 See https://oss.redislabs.com/redisearch/Aggregations/#list%22_%22of%22_%22datetime%22_%22apply%22_%22functions 请参阅https://oss.redislabs.com/redisearch/Aggregations/#list%22_%22of%22_%22datetime%22_%22apply%22_%22functions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM