[英]Date format in Google Cloud Storage changes date to YYYY-DD-MM format
[英]comparen today's date with date format YYYY-DD-MM in dynamodb table
我有一个名称表:日期值为 YYYY-DD-MM 的DATETABLE , AWS dynamodb中的数据类型为字符串,它具有分区键,日期为字符串
const currentdate = new Date().toISOString().split('T')[0];
client.query({
TableName: 'date',
KeyConditionExpression: 'date = :todaydate',
ExpressionAttributeValues: {
':todaydate': currentdate
}
})
我只想将日期值与当前(今天)日期进行比较,例如使用关键条件
KeyConditionExpression: 'date = :currentdate',
根据输入返回 true 或 false。 这就像直接查询 SELECT * FROM date WHERE DATE = 2022-14-12(current date) (table value)
错误:意外参数:在 params.ExpressionAttributeValues[':date'] 中发现意外键“7”
尝试:
const currentdate = new Date().toISOString().split('T')[0];
client.query({
TableName: 'date',
KeyConditionExpression: 'date = :todaydate',
ExpressionAttributeValues: {
':todaydate': {'S':currentdate}
}
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.