How to get current time and date in Android

M7M picture M7M · Mar 20, 2011 · Viewed 1.5M times · Source

How can I get the current time and date in an Android app?

Answer

user658042 picture user658042 · Mar 20, 2011

You could use:

import java.util.Calendar

Date currentTime = Calendar.getInstance().getTime();

There are plenty of constants in Calendar for everything you need.

Edit:
Check Calendar class documentation