LogRecord getMillis() method in Java with Examples Last Updated : 23 Oct, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The getMillis() method of java.lang.reflect.LogRecord is used to get the event time in LogRecord.This event time has unit in MilliSeconds since 1970. Syntax: public long getMillis() Parameters: This method accepts nothing. Return: This method returns truncated event time in millis since 1970. Below programs illustrate getMillis() method: Program 1: Java // Java program to illustrate // getMillis() method import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Level; import java.util.logging.LogRecord; public class GFG { public static void main(String[] args) { // Create LogRecord object LogRecord logRecord = new LogRecord( Level.parse("800"), "Hi Logger"); logRecord.setMillis(999999999900L); // get event time long millis = logRecord.getMillis(); // get event time and // convert it into a date DateFormat simple = new SimpleDateFormat( "dd MMM yyyy HH:mm:ss:SSS Z"); Date result = new Date(millis); System.out.println( "Event Time " + simple.format(result)); } } Output: Event Time 09 Sep 2001 07:16:39:900 +0530 Program 2: Java // Java program to illustrate // getMillis() method import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Level; import java.util.logging.LogRecord; public class GFG { public static void main(String[] args) { // Create LogRecord object LogRecord logRecord = new LogRecord( Level.parse("600"), "GFG Logger"); logRecord.setMillis(9632736138L); // get event time long millis = logRecord.getMillis(); // get event time and // convert it into a date DateFormat simple = new SimpleDateFormat( "dd MMM yyyy HH:mm:ss:SSS Z"); Date result = new Date(millis); System.out.println( "Event Time " + simple.format(result)); } } Output: Event Time 22 Apr 1970 17:15:36:138 +0530 References: https://docs.oracle.com/javase/10/docs/api/java/util/logging/LogRecord.html#getMillis() Comment More infoAdvertise with us Next Article LogRecord getInstant() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-LogRecord java.util.logging package Practice Tags : Java Similar Reads LogRecord getLevel() method in Java with Examples The getLevel() method of java.util.logging.LogRecord is used to get the logging message level of this current LogRecord object, for example Level.Info. Syntax: public Level getLevel() Parameters: This method accepts nothing. Return: This method returns the logging message level. Below programs illus 1 min read LogRecord getInstant() method in Java with Examples The getInstant() method of java.lang.reflect.LogRecord is used to get this instant that the event occurred this is helpful to record logging events instant. Syntax: public Instant getInstant() Parameters: This method accepts nothing. Return: This method returns the instant that the event occurred. B 1 min read LogRecord getMessage() method in Java with Examples The getMessage() method of java.util.logging.LogRecord is used to get the actual log message, before localization or formatting from this logRecord.This message may be null, which is equivalent to the empty string "". This returned message may be either the final text or a localization key. Syntax: 2 min read LogRecord getThreadID() method in Java with Examples The getThreadID() method of java.lang.reflect.LogRecord is used to get an identifier for the thread where the message originated. This method is helpful to identify thread which generates the logger message. Syntax: public int getThreadID() Parameters: This method accepts nothing. Return: This metho 2 min read LogRecord getThrown() method in Java with Examples The getThrown() method of java.lang.reflect.LogRecord is used to get a throwable associated with the log event.This is used to log Exceptions in the logRecord that can be used for logging messages. Syntax: public Throwable getThrown() Parameters: This method accepts nothing. Return: This method retu 1 min read LogRecord getParameters() method in Java with Examples The getParameters() method of java.lang.reflect.LogRecord is used to get the parameters to the log message.These parameters are the parameters to be inserted into the message of this LogRecord. Syntax: public Object[] getParameters() Parameters: This method accepts nothing. Return: This method retur 1 min read Like