Code example for Calendar

Methods: clone

     * @throws NullPointerException if <code>calendar</code> is 
     *     <code>null</code>. 
    public long getFirstMillisecond(Calendar calendar) {
        Calendar c = (Calendar) calendar.clone();
        c.set(Calendar.YEAR, this.year);
        c.set(Calendar.WEEK_OF_YEAR, this.week);
        c.set(Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek());
        c.set(Calendar.HOUR, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
        //return c.getTimeInMillis();  // this won't work for JDK 1.3 
        return c.getTime().getTime();
     * Returns the last millisecond of the week, evaluated using the supplied 
Stop searching for code, let great code find you!  Add Codota to your java IDE