Here is a simple code to get the current time in android in your own format.

long tim=System.currentTimeMillis();
 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
 String curTime =df.format(tim);
 System.out.println("Time : " + curTime);

The output will look like this.


Time : 2011-10-17 09:54:24

 

Leave a Reply

Your email address will not be published. Required fields are marked *

 

 

 

Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.