Tabnine Logo
Date.setHours
Code IndexAdd Tabnine to your IDE (free)

How to use
setHours
method
in
java.util.Date

Best Java code snippets using java.util.Date.setHours (Showing top 20 results out of 378)

origin: stackoverflow.com

 Date today = new Date();
today.setHours(0); //same for minutes and seconds
origin: stackoverflow.com

Date date = new Date();
 date.setHours(date.getHours() + 8);
 System.out.println(date);
 SimpleDateFormat simpDate;
 simpDate = new SimpleDateFormat("kk:mm:ss");
 System.out.println(simpDate.format(date));
origin: com.google.gwt/gwt-servlet

@Override
public void setHours(int hours) {
 checkFrozen();
 super.setHours(hours);
}
origin: tianshaojie/AndroidFine

public static String getSimpleTimeString(long time) {
  String strTemp = "";
  Date dateCreate = new Date(time);
  Date dateNow = new Date();
  dateNow.setHours(0);
  dateNow.setMinutes(0);
  dateNow.setSeconds(0);
  if (dateCreate.before(dateNow)) {
    SimpleDateFormat myFmt2 = new SimpleDateFormat("MM-dd");
    myFmt2.setTimeZone(TimeZone.getDefault());
    strTemp = myFmt2.format(dateCreate);
  } else {
    SimpleDateFormat myFmt2 = new SimpleDateFormat("HH:mm");
    myFmt2.setTimeZone(TimeZone.getDefault());
    strTemp = myFmt2.format(dateCreate);
  }
  return strTemp;
}
origin: com.google.gwt/gwt-servlet

/**
 * Resets the date to have no time modifiers. Note that the hour might not be zero if the time
 * hits a DST transition date.
 *
 * @param date the date
 */
@SuppressWarnings("deprecation") // GWT requires Date
public static void resetTime(Date date) {
 long msec = resetMilliseconds(date.getTime());
 date.setTime(msec);
 date.setHours(0);
 date.setMinutes(0);
 date.setSeconds(0);
}
origin: stackoverflow.com

date2am.setHours(TWO_AM); 
date2am.setMinutes(ZERO_MINUTES); 
origin: com.google.gwt/gwt-servlet

date.setHours(this.hours == 24 && this.midnightIs24 ? 0 : this.hours);
origin: stackoverflow.com

 public static void main(String[] args) {
  final Date now = new Date();
  System.out.println(now);
  now.setHours(5);
  System.out.println(now);
}
origin: net.wetheinter/gwt-user

@Override
public void setHours(int hours) {
 checkFrozen();
 super.setHours(hours);
}
origin: org.n52.sensorweb/sensorwebclient-ui

private Date createDate(Date date, String time) {
  if (time.length() == 5) {
    date.setHours(new Integer(time.substring(0, 2)));
    date.setMinutes(new Integer(time.substring(3, 5)));
  } else if (time.length() == 4) {
    date.setHours(new Integer(time.substring(0, 1)));
    date.setMinutes(new Integer(time.substring(2, 4)));
  }
  return date;
}
origin: stackoverflow.com

 AlarmManager am = (AlarmManager) con.getSystemService(Context.ALARM_SERVICE);

Date futureDate = new Date(new Date().getTime() + 86400000);


futureDate.setHours(8);
futureDate.setMinutes(0);
futureDate.setSeconds(0);


Intent intent = new Intent(con, MyAppReciever.class);

PendingIntent sender = PendingIntent.getBroadcast(con, 0, intent,
    PendingIntent.FLAG_UPDATE_CURRENT);
origin: com.centurylink.mdw/mdw-common

@SuppressWarnings("deprecation")
protected static Date getRoundDate(Date date) {
  Date roundDate = new Date(date.getTime());
  roundDate.setHours(0);
  roundDate.setMinutes(0);
  roundDate.setSeconds(0);
  return roundDate;
}
origin: EvoSuite/evosuite

@SuppressWarnings("deprecation")
public void setHours(int hours) {
  Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, this, "setHours", "(I)V", new Object[] {hours});
  super.setHours(hours);
  Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_UTIL_DATE, this, CaptureLog.RETURN_TYPE_VOID);
}
origin: com.vaadin.external.gwt/gwt-user

private static void addDays(Date date, int days) {
 CalendarUtil.addDaysToDate(date, days);
 if (date.getHours() != 0) {
  // We hit DST transition, try reseting back so follow up days continue showing midnight:
  date.setHours(0);
 }
}
origin: protegeproject/webprotege

/**
 * Taken from {@link com.google.gwt.user.datepicker.client.CalendarUtil}
 */
private static void resetTime(Date date) {
  long msec = resetMilliseconds(date.getTime());
  date.setTime(msec);
  date.setHours(0);
  date.setMinutes(0);
  date.setSeconds(0);
}
origin: stackoverflow.com

AlarmManager am = (AlarmManager) con
     .getSystemService(Context.ALARM_SERVICE);
 Date futureDate = new Date(new Date().getTime() + 86400000);
 futureDate.setHours(8);
 futureDate.setMinutes(0);
 futureDate.setSeconds(0);
 Intent intent = new Intent(con, MyAppReciever.class);
 PendingIntent sender = PendingIntent.getBroadcast(con, 0, intent,
     PendingIntent.FLAG_UPDATE_CURRENT);
 am.set(AlarmManager.RTC_WAKEUP, futureDate.getTimeInMillis(), sender);
origin: oVirt/ovirt-engine

  private Date getExecutionTimeValue(GlusterVolumeSnapshotSchedule schedule) {
    Date dt = new Date();
    dt.setHours(schedule.getExecutionTime().getHours());
    dt.setMinutes(schedule.getExecutionTime().getMinutes());
    return dt;
  }
}),
origin: com.vaadin.addon/vaadin-touchkit-agpl

@SuppressWarnings("deprecation")
protected Date trySetTimeFromTimeBoxText(Date value) {
  try {
    Date time = timeOnlyFormat.parse(timeBox.getText());
    value.setHours(time.getHours());
    value.setMinutes(time.getMinutes());
  } catch (IllegalArgumentException e) {
    // Couldn't parse hours, just ignore them and use the old,
    // unmodified value.
  }
  return value;
}
origin: org.openmuc/openiec61850

  @SuppressWarnings("deprecation")
  @Override
  protected void writeImpl() {
    Date newDate = dateChooser.getDate();
    Date timeValues = (Date) timeSpinner.getValue();
    newDate.setHours(timeValues.getHours());
    newDate.setMinutes(timeValues.getMinutes());
    newDate.setSeconds(timeValues.getSeconds());
    data.setDate(newDate);
  }
}
origin: org.dashbuilder/dashbuilder-dataset-api

@Before
public void setUp() throws Exception {
  Date startTime = new Date();
  startTime.setYear(115);
  startTime.setMonth(10);
  startTime.setDate(10);
  startTime.setHours(12);
  startTime.setMinutes(50);
  startTime.setSeconds(30);
  TimeInstant.START_TIME = startTime;
}
java.utilDatesetHours

Javadoc

Sets the gregorian calendar hour of the day for this Date object.

Popular methods of Date

  • <init>
    Constructs a new Date initialized to the date and time parsed from the specified String.
  • getTime
    Returns this Date as a millisecond value. The value is the number of milliseconds since Jan. 1, 1970
  • toString
    Returns a string representation of this Date. The formatting is equivalent to using a SimpleDateForm
  • before
    Returns if this Date is before the specified Date.
  • equals
    Compares the specified object to this Date and returns if they are equal. To be equal, the object mu
  • after
    Returns if this Date is after the specified Date.
  • compareTo
    Compare the receiver to the specified Date to determine the relative ordering.
  • hashCode
    Returns an integer hash code for the receiver. Objects which are equal return the same value for thi
  • setTime
    Sets this Date object to represent a point in time that istime milliseconds after January 1, 1970 00
  • from
  • toInstant
  • clone
    Returns a new Date with the same millisecond value as this Date.
  • toInstant,
  • clone,
  • getYear,
  • getMonth,
  • getDate,
  • getHours,
  • getMinutes,
  • getSeconds,
  • getDay,
  • setMinutes

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getApplicationContext (Context)
  • setContentView (Activity)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now