gpt4 book ai didi

mysql - Modx revo 不比较 getResourses 中的日期类型 TV

转载 作者:行者123 更新时间:2023-11-29 11:46:23 27 4
gpt4 key购买 nike

我正在尝试将电视中的日期与片段中的日期进行比较(我正在使用 &tvFilters)(或任何其他日期字符串),但仅适用于 == 和 != 操作?但我需要创建 >= 和 <=,有什么问题吗?例子说它必须工作,这可能是一些MYSQL问题吗?看起来就像比较字符串...

[[!getResources? &showHidden=`1`  &processTVs=`1` &includeTVs=`1` 
&tpl=`rotatorPost` &includeContent=`1` &parents=`5` &limit=`3`
&tvFilters=`Date>=2016-01-19 00:00:00` ]]

最佳答案

您必须确保两个日期都转换为 unix 时间戳 [电视可能已经是了]您必须检索未处理的电视“日期”[&processTVs=0] 或将其输出类型设置为数字。您的代码片段还必须提供数字类型的日期。

无论如何,您都必须检查文档以确保 getResources 不会将任一值视为字符串,否则:

&tvFilters=1453239348 >= 1453239399 会给你意想不到的结果。

虽然文档在这方面看起来不错:

New filter operators available in 1.4.2-pl Starting with release 1.4.2-pl of getResources, there are a number of new comparison operators for use when creating filter conditions. In addition, when using many of these new operators, numeric comparison values are automatically CAST TV values to numeric before comparison. Here is a list of the valid operators:

关于mysql - Modx revo 不比较 getResourses 中的日期类型 TV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34866348/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com