CHANGED:applied the hour calculate function