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 |