【问题标题】:HQL How to process equals for day of week and date without hour,minute,second?HQL如何处理没有小时,分钟,秒的星期几和日期?
【发布时间】:2013-10-16 03:26:12
【问题描述】:

型号:Foo

字段:id(Long)、barDate(Date)、barDay(Integer 1..7)

数据库:Mysql

当 barDate 是今天(不关心时、分、秒)或 barDay 是星期几时如何查询 Foo?

你能给我举个 HQL 或 SQL 的例子吗?谢谢。

【问题讨论】:

    标签: mysql sql hibernate hql


    【解决方案1】:

    试试这个:

    from Foo where date_format(barDate ,'%Y%m%d') = CURDATE()
    

    【讨论】:

      猜你喜欢
      • 2020-10-18
      • 1970-01-01
      • 1970-01-01
      • 2021-09-17
      • 1970-01-01
      • 2017-10-18
      • 1970-01-01
      • 1970-01-01
      • 2020-08-15
      相关资源
      最近更新 更多