Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QueryDSL - select rows with date from timestamp column

Tags:

querydsl

Using QueryDSL - is there a way to select rows by date from a timestamp other than using .between? Something like this query:

where convert(date, mytimestamp) = '2013-02-28'

like image 575
Jaffa Avatar asked Oct 04 '22 15:10

Jaffa


1 Answers

You can either use between or a custom expression if you use Querydsl SQL

Something like this

DateExpression<Date> converted = DateTemplate.create(Date.class, "convert(date, {0})", mytimestamp);
like image 82
Timo Westkämper Avatar answered Oct 09 '22 13:10

Timo Westkämper