-->
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.  [ 2 posts ] 
Author Message
 Post subject: How can i get the difference between two date
PostPosted: Sun Apr 18, 2004 3:13 am 
Newbie

Joined: Sun Apr 18, 2004 2:29 am
Posts: 18
hi
i am using hibernate and oracle for my application

i need to make a query which return the difference between two date
i am using java.util.Date for the date property.

in details the problem is i need to know the age from the birth date.
how can i write a quey which will give me the difference between the birth date and the current date


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 18, 2004 9:32 am 
Newbie

Joined: Sun Feb 08, 2004 9:30 am
Posts: 8
Location: Europe
Hi,

you should just get the current time in Millisecons with "System.currentTimeMillis()" and save it as a "long". Then get the date you wanted, get it's time in millis and subtract from each other. Now you have the difference in millis and you just need to divide until you have the unit you want.
Cheers,

Lutz


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

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.