Java Day From getNoonOfDay(Date day)

Here you can find the source of getNoonOfDay(Date day)

Description

get Noon Of Day

License

Apache License

Declaration

public static Date getNoonOfDay(Date day) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {

    public static Date getNoonOfDay(Date day) {
        if (day == null)
            day = new Date();

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(day);/*from ww w  . j ava  2s.com*/
        calendar.set(Calendar.HOUR_OF_DAY, 12);
        calendar.set(Calendar.MINUTE, calendar.getMinimum(Calendar.MINUTE));
        calendar.set(Calendar.SECOND, calendar.getMinimum(Calendar.SECOND));
        calendar.set(Calendar.MILLISECOND, calendar.getMinimum(Calendar.MILLISECOND));
        return calendar.getTime();
    }
}

Related

  1. getFirstMilliOfDay(Date date)
  2. getIntervalInDaysSofar(Date from)
  3. getLastDay(Date date)
  4. getNextDay(Date startTime, int n)
  5. getNextDay(String date)
  6. getPlusDay(String _oneDay, int _aFewDays)
  7. getServerOffset(boolean useDaylightSavingTime)
  8. getTimeField(Date day, int field)
  9. isBusinessDay(int dateIntToCheck)