For getting current (today) date and time in android application, we used calendar class get the current instance of android phone clock. After getting calendar class object, we required a formatted object for date and time. Calendar c = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("dd:MMMM:yyyy HH:mm:ss a"); String strDate = sdf.format(c.getTime()); System.out.println("================>>>"+strDate); Android Time formats table d single digit date e.g. 5 dd double digit date e.g. 05 M single digit month e.g. 1 MM double digit month e.g. 01 MMM three-letter abbreviation for month e.g. Jan MMMM month spelled out in full e.g. January yy double digit year e.g. 13 yyyy four digit year e.g. 2013 Android Time format table h single digit hours in 12 h...
A blog where you can find all codes for Android, Corona, Basic tutorials, Interview questions and more...