-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: using HQL to calculate Date difference
PostPosted: Mon Jun 12, 2006 12:58 pm 
Newbie

Joined: Mon Jun 12, 2006 12:49 pm
Posts: 1
Hi guys
Suppose there is a table in MySql database which has two fields of type Date, say startDate and endDate. Now, what's the exact HQL query to retrieve those records whose the difference between start and end date is e.g. 57 days. I have used the subtraction operator (-) but it doesn't work for days whose difference is more than 30 days. My HQL query is something like this:

"from Task task where (task.endDate-task.startDate)=60"

Thanks in advance for any help
-Maysam


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.