Format date in hql query
Posted
by user115520
on Stack Overflow
See other posts from Stack Overflow
or by user115520
Published on 2009-07-04T15:23:02Z
Indexed on
2010/06/17
3:53 UTC
Read the original article
Hit count: 542
hi all,
i want to format date to string in hql select, for example i have purchasing data with transaction date in it:
class Purchase { private Date datePurchase }
and i want to select date in a certain format, for example yyyyMMdd, can i do that in hql?
actually i can iterate through all purchase data returned by query, and start to format the date using SimpleDateFormat, but i don't want do that, i want to do it in hql, is it posible?
fyi, i just want to return the id and date string only, not all Purchase field.
thak you all for any help.
© Stack Overflow or respective owner