I use the date class to get the current hour with the function
Date date = new Date();
int t=date.getHours();
and eclipse keeps complaining about code deprecation. Everything works absolutely fine, but it keeps warning me about it, is there a reason I should change it? is there an alternative to getting current time?
Some parts of a library are marked deprecated when an issue is found with them but the designers decide that an improvement on the existing part could break many existing programs that already rely on the old behavior.
So, they keep the existing part, at least for some time (to maintain the ability of existing sources to compile until they are updated), while usually offering an alternative instead.
Now, regarding time in Java, most people recommend Joda time.