In general we require Time & Date in many applications so here i will be showing in general how to get Time and Date in this tutorial.

Starting with this tutorial i want to clarify one thing Time and Date are fetched from device in android device there is an option available in settings for user to  set Time.

This tutorial doesn’t require Internet or any thing more just will work with device in getting in device.

timedate

 

Creating MainActivity.java File

MainActivity.java

 

Creating activity_main.xml File

 

Here i have designed the screen by adding textviews required and also made the design easily understandable.

activity_main.xml

 

Output :

time&date  

Show Buttons
Hide Buttons
Read previous post:
Android Tutorial on Listview

Close