public Integer countWeekday(Date startDate) {

        startDate.setHours(0);
        startDate.setMinutes(0);
        startDate.setSeconds(0);

    }

I have this function and a parameter passed to it.
setHours,setMinutes and setSeconds are deprecated.
What else can i use?

Recommended Answers

All 6 Replies

Use java.util.GregorianCalendar instead of Date.
This class does days, weeks, months etc properly, and is the reason why the old methods in the Date class were deprecated.

ps: When you look at the javadoc for GregorianCalendar you'll find all the interesting methods are inherited from the abstract class Calendar, so don't forget to look there as well.

could you give me an example?

If you read the JavaDoc for Calendar and GregorianCalendar you will find comprehensive examples right in the first section.

What is the format of date and time when you insert into Oracle Database?
At me, only dis format works. eg : 14-FEB-2011

@lili.edryana

hmmmm as I see you totally ignored more that 100.examples about Date & Calendar, good to know

on pages that I send link is complete Sql-92 + Oracle-Sql manual

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.