begin and end of day time

package testcode;

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

 * @author saifiahmada
public class BeginAndEndOfDay {
  public static void main(String[] args) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 00);
    cal.set(Calendar.SECOND, 00);
    System.out.println("Begin Of Day "+cal.getTime());
    cal.set(Calendar.HOUR_OF_DAY, 23);
    cal.set(Calendar.MINUTE, 59);
    cal.set(Calendar.SECOND, 59);
    System.out.println("End Of Day "+cal.getTime());


== Result ==
Begin Of Day Fri Jan 27 00:00:00 CIT 2012
End Of Day Fri Jan 27 23:59:59 CIT 2012
BUILD SUCCESSFUL (total time: 1 second)


Published by


Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s