• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps System Clock/Time?

Hi everyone,

I'm new to android development and I'm just trying to find my way around with various tutorials. As my first project I'm trying to create a simple night clock, but I don't know how to access the system clock/time.

How exactly would one go about doing this? I simply want to display the time on the screen, and then add some other stuff to it later.

Thanks,
Jitin
 
This will give you a calendar object with the current date/time.

Calendar _Current = Calendar.getInstance();

Then for example you want to know the current hour:
int _CurrentHour = _Current.get(Calendar.HOUR_OF_DAY);
 
Back
Top Bottom