reading date and time from device

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

reading date and time from device

Postby sk.android » Wed Jul 22, 2009 12:52 pm

Hi friends,
can anyone please tell me how can we read date and time from device.
Thanks in advance
sk
sk.android
Freshman
Freshman
 
Posts: 2
Joined: Wed Jul 22, 2009 11:45 am

Top

Postby mathuin » Thu Jul 23, 2009 2:01 am

I use java.util.Calendar to do that. It's really easy to use.

I get the current date and time with a line like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Calendar now = Calendar.getInstance();
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


I can access the minutes with something like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. int minutes = now.get(Calendar.MINUTES);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


Hope that helps!
mathuin
Junior Developer
Junior Developer
 
Posts: 15
Joined: Wed Jul 15, 2009 3:10 am

reading date and time

Postby sk.android » Thu Jul 23, 2009 8:10 am

Thanks for response.
sk.android
Freshman
Freshman
 
Posts: 2
Joined: Wed Jul 22, 2009 11:45 am

Top

Return to General

Who is online

Users browsing this forum: No registered users and 3 guests