Java Date Start getStartOfMonth(Date date)

Here you can find the source of getStartOfMonth(Date date)

Description

get Start Of Month

License

Apache License

Declaration

public static Date getStartOfMonth(Date date) 

Method Source Code

//package com.java2s;
/**//from   w  w  w . jav a 2  s .c o  m
 * Tern Framework.
 * 
 * @author fancimage
 * @Copyright 2010 qiao_xf@163.com Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 */

import java.util.Date;

public class Main {
    public static Date getStartOfMonth(Date date) {
        java.util.Calendar cal = java.util.Calendar.getInstance();
        cal.setTime(date);
        cal.set(java.util.Calendar.DATE, 1);
        return cal.getTime();
    }
}

Related

  1. getStartOfDate(final Date date)
  2. getStartOfDay(Date date)
  3. getStartOfDay(Date date)
  4. getStartOfDay(Date day)
  5. getStartOfDay(Date day)
  6. getStartOfMonth(Date dt)
  7. getStartOfMonth(Date dt)
  8. getStartOfQuarter(Date dt)
  9. getStartTimeByManDay(Date serviceStartTime)