Java Date Now getCurrentWeekFirst()

Here you can find the source of getCurrentWeekFirst()

Description

get Current Week First

License

Open Source License

Declaration

public static String getCurrentWeekFirst() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * @(#)DateUtil.java Oct 23, 2007/*  w ww .  j a  v a2 s.c o  m*/
 *
 * Copyright 2007 Neusoft Group Ltd. All rights reserved.
 * Neusoft PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *******************************************************************************/

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {

    public static String getCurrentWeekFirst() {
        StringBuffer str = new StringBuffer();
        java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd");
        Calendar c = new GregorianCalendar();
        c.setFirstDayOfWeek(Calendar.MONDAY);
        c.setTime(new Date());
        c.set(Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek()); // Monday

        str.append(df.format(c.getTime()));
        str.append(" 00:00:00");

        return str.toString();
    }
}

Related

  1. getCurrentUTCString()
  2. getCurrentUTCTime()
  3. getCurrentUTCTimeAsString()
  4. getCurrentWeekDay(Date date, int day)
  5. getCurrentWeekDays()
  6. getCurrentYear()
  7. getCurrentYearBegDate(Date date)
  8. getCurrentYMDDate()
  9. getCurrentZeroTime()