Java.util.Calendar.setTimeInMillis(long) Method Example
JAVA.UTIL.CALENDAR.SETTIMEINMILLIS METHOD
Copyright ?
Description
The java.util.Calendar.setTimeInMillislong method sets Calendar's current time from the given long value.
Declaration
Following is the declaration for java.util.Calendar.setTimeInMillis method
public void setTimeInMillis(long millis)
Parameters
millis -- the new time in UTC milliseconds from the epoch.
Return Value
This method does not return a value.
Exception
NA
Example
The following example shows the usage of java.util.calendar.setTimeInMillis method.
package com.tutorialspoint;
import java.util.*;
public class CalendarDemo {
public static void main(String[] args) {
// create a calendar Calendar cal = Calendar.getInstance();
// get the time in milliseconds System.out.println("Current time is :" + cal.getTime());
// set time to 5000 ms after january 1 1970 cal.setTim eInMillis(5000);
// print the new time System.out.println("After setting Time: " + cal.getTime()); } }
Let us compile and run the above program, this will produce the following result:
Current time is :Wed May 02 20:36:23 EEST 2012 After setting Time: Thu Jan 01 02:00:05 EET 1970
Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- settimeinmillis long method example
- good versus better sdtm date and timing variables
- it s about precision time artel video systems
- version 0 9
- std chrono typesafe time keeping in c
- computer networks cs132 eecs148 spring 2013
- fundamental concepts nasa
- package rthingsboard
- date and time
- time now in milliseconds
Related searches
- java array example code
- java example code for beginners
- example of java program
- example java code hello world
- java class example code
- string to java util date
- arraylist java exam example code
- java arraylist example code
- java get calling method name
- java reflection get method name
- java main method string args
- tostring method java array