public class Employee {
private String name;
private long timestamp;
}
时间戳以长格式保存。转换后将为2021-11-19T21:00 37.353+0000
用户输入仅为2021-11-19,我们如何忽略时间/时区进行查询,查询日期的正确方式是什么?
Gemfire查询
select * from /employee where to_date(timestamp) = to date(2021-21-19)
Error -> Query is invalid due to error - Syntax error in query - unexpected token-timestamp
看起来您的查询表达式是错误的。根据文档中的预设查询函数,TO_DATE
函数需要两个参数:使用java.text.SimpleDateFormat
类将String
转换为Date
时要解析的实际值和要使用的字符串格式。
不过,我不确定是否有支持的格式可用于您的情况,因此您可能需要在域对象或OQL
本身中做一些额外的操作,以便从timestamp
字段中获得Date
表示。
干杯。