如何在 MQL Freebase 查询中表达当前日期?
如果您传入 ISO8601 格式的日期。
[{
"id": null,
"name": null,
"start_date" : null,
"type": "/time/event",
"start_date>" : "2011-09-02"
}]
^ <一href="http://www.freebase.com/queryeditor?q=%5B%7B%22id%22%3Anull%2C%22name%22%3Anull%2C%22start_date%22% 3Anull%2C%22type%22%3A%22%2Ftime%2Fevent%22%2C%22start_date%3E%22%3A%222011-09-02%22%7D%5D&自动运行=1" rel="nofollow noreferrer">运行此查询
MQL 是否支持与 SQL 的 NOW()
或 CURDATE()
等效的查询?
Freebase's metaweb query language can be used to retreive future events if you pass in an ISO8601 formatted date.
[{
"id": null,
"name": null,
"start_date" : null,
"type": "/time/event",
"start_date>" : "2011-09-02"
}]
Does MQL support an equivalent to SQL's NOW()
or CURDATE()
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以在时间戳字段中使用
__now__
作为特殊快捷方式:您可以通过 此 Freebase 查询编辑器片段。
You can also use
__now__
in timestamp fields as a special shortcut:You can see a live demo of this via this Freebase Query Editor snippet.
MQL 中没有与 SQL 的 NOW() 或 CURDATE 等效的函数。无论您使用哪种编程语言发送查询,都应该具有可以使用的等效函数。
您可以通过按 start_date 降序对未来事件进行排序来获取未来事件的列表,如下所示:
There is no equivalent to SQL's NOW() or CURDATE in MQL. Whichever programming language you're using to send the query should have an equivalent function which you can use.
You can kind of get a list of future events by sorting them in descending order of start_date like this: