Java Calendar Hour setHours(int i, Calendar calendar)

Here you can find the source of setHours(int i, Calendar calendar)

Description

When rectify deprecation error we will need to test that making changes to Calendar actually affects the underlying date.

License

LGPL

Declaration


public static void setHours(int i, Calendar calendar) 

Method Source Code

//package com.java2s;
/*/*from w ww  .  ja  v a  2 s . co m*/
Strandz LGPL - an API that matches the user to the data.
Copyright (C) 2007 Chris Murphy
    
Strandz LGPL is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
    
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
    
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    
    
The authors can be contacted via www.strandz.org
*/

import java.util.Calendar;

public class Main {
    /**
     * When rectify deprecation error we will need to test that
     * making changes to Calendar actually affects the underlying
     * date.
     */
    /*
    public static void setMinutes( int i, Date date )
    {
      date.setMinutes( i );
    }
    */
    public static void setHours(int i, Calendar calendar) {
        calendar.set(Calendar.HOUR_OF_DAY, i);
    }
}

Related

  1. moveToCalendarHourTerminal(Calendar cal)
  2. sameHour(Calendar one, Calendar two)
  3. setCalendar(int hour, int mins)
  4. setDateToZeroHour(Calendar calendar)
  5. setHourMinSecAsNull(Calendar calendar)
  6. setMinHour(Calendar gc)
  7. toMinHours(Calendar calendar)
  8. truncateHour(Calendar c)
  9. truncateToHour(Calendar cal)