---
title: "Get current time and date on Android"  
description: "Get current time and date on Android"  
author: "Anonymous User"  
published: 2015-06-11  
updated: 2015-06-11  
canonical: https://www.mindstick.com/forum/23289/get-current-time-and-date-on-android  
category: "android"  
tags: ["android"]  
reading_time: 2 minutes  

---

# Get current time and date on Android

How can I get the [current time and date](https://www.mindstick.com/interview/33838/what-is-the-function-to-find-the-current-time-and-date-in-sql-server) in an [Android app](https://www.mindstick.com/articles/208957/a-complete-guide-for-android-app-development)?

## Replies

### Reply by Anonymous User

Simplest way is to use :\

```
Calendar c = Calendar.getInstance(); int seconds = c.get(Calendar.SECOND);
```

There are plenty of constants in Calendar for everything you need. Calendar class documentation\
Also,You can use [android](https://www.mindstick.com/articles/13046/10-reasons-why-i-prefer-android-vs-iphone-ios).text.format.Time:\

```
Time now = new Time();now.setToNow();
```

From the reference linked above:\
The Time class is a faster replacement for the java.util.Calendar and java.util.GregorianCalendar classes. An instance of the Time class represents a moment in time, specified with second precision.NOTE 1: It's been several years since I wrote this answer, and Google now says that "[t]his class has a number of issues and it is recommended that GregorianCalendar is used instead".\
NOTE 2: Even though the Time class has a toMillis(ignoreDaylightSavings) method, this is merely a convenience to pass to methods that expect time in milliseconds. The time value is only precise to one second; the milliseconds portion is always 000. If in a loop you do\

```
Time time = new Time();   time.setToNow();Log.d("TIME TEST", Long.toString(time.toMillis(false)));
```

... do something that takes more than one millisecond, but less than one second ...The resulting sequence will repeat the same value, such as 1410543204000, until the next second has started, at which time 1410543205000 will begin to repeat.


---

Original Source: https://www.mindstick.com/forum/23289/get-current-time-and-date-on-android

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
