Thursday, 4 May 2017

Java Tutorial: System class in java [How to get Current time in ms]


Click here to watch in Youtube :
https://www.youtube.com/watch?v=roTe2_lI26A&list=UUhwKlOVR041tngjerWxVccw

SystemDemo.java
import java.io.IOException;
import java.util.Date;

public class SystemDemo
{

    public static void main(String[] args) throws IOException
    {
        /*
         * Returns the current time in milliseconds.
         */
        long currentTimeInms = System.currentTimeMillis();
        System.out.println("Current Time in milliseconds = " + currentTimeInms);
        
        Date date = new Date(currentTimeInms);      
        System.out.println("Current date and Time = "+date);

    }
}
Output
Current Time in milliseconds = 1488772077364
Current date and Time = Mon Mar 06 09:17:57 IST 2017

Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/SystemDemo_CTinMS_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/SystemDemo_CTinMS_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2f1fa585daa61fc8fa0957d6f04b940eddbcf7ec/BasicJava/SystemDemo_CTinMS_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • No comments:

    Post a Comment

    Google+ Followers

    Google+ Badge