Here you can find the source of alignMonth(Calendar timestamp)
Parameter | Description |
---|---|
timestamp | The calendar to align. |
public static Calendar alignMonth(Calendar timestamp)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**/* w w w . ja va 2 s.c o m*/ * Aligns the time fields to the start of the month. * @param timestamp The calendar to align. * @return The parameter. */ public static Calendar alignMonth(Calendar timestamp) { timestamp.set(Calendar.DAY_OF_MONTH, 1); return alignDay(timestamp); } /** * Aligns the time fields to the start of the day. * @param timestamp The calendar to align. * @return The parameter. */ public static Calendar alignDay(Calendar timestamp) { timestamp.set(Calendar.HOUR_OF_DAY, 0); timestamp.set(Calendar.MINUTE, 0); timestamp.set(Calendar.SECOND, 0); timestamp.set(Calendar.MILLISECOND, 0); return timestamp; } }