Questions tagged [android-date]
276 questions
5
votes
2 answers
Convert date from default locale to english locale
I have saved dates by formatting them using SimpleDateFormat.
DateFormat dateForm = new SimpleDateFormat("HH mm ss dd MMM ''yy");
String dateOutput = dateForm.format(new Date());
This uses the default Locale of the device, for example…
user2442638
4
votes
4 answers
Java : How to parse date format to show specific output format?
In my app, i retrieve date from my database in a specific format. (Generated by PHP)
I would like to show a specific output in my Android app for this cases :
Input format from database : 2014-05-30 17:50:50
I would like to be able to show this…

wawanopoulos
- 9,614
- 31
- 111
- 166
4
votes
2 answers
Datepicker dialog does not match the date selected
Please refer to the following image:
The text above says Thu, Oct 28, 1909...while the datepicker actually has the value 3rd jan, 1902.
What is the mistake?
Here is my code:
@SuppressWarnings("deprecation")
public void setTheDate(View v){
…

Randomly Named User
- 1,889
- 7
- 27
- 47
4
votes
1 answer
Android Display a date of the week
i want to display the days of the week with the date of that week.
Like today, i want to display for my calendar is like this:
Mon Tues Wed Thurs Fri Sat Sun
8 9 10 11 12 13 14
Then, when it another week starts, the…

elL
- 767
- 2
- 14
- 35
4
votes
2 answers
Hours and minutes from date in android
I have java util date as Thu Feb 28 15:35:00 GMT+00:00 2013
How to convert it to HH:MM.
I am trying to do this via below snippet:
SimpleDateFormat formatter = new SimpleDateFormat("HH:MM");
…

Ankit HTech
- 1,863
- 6
- 31
- 42
4
votes
3 answers
comparing milliseconds with data in android
I have data+time in saved in database (sq lite) in milliseconds, now I want to get data from sq-lite of a specific date and I have date in this format "26-December-2012", how to compare this with milliseconds.
what should be the query to fetch data…

Saqib Abbasi
- 607
- 2
- 6
- 17
4
votes
2 answers
Get current date as String warning deprecated toGmtString() issue
I want to get the current date day/month/year min:sec in Android so I have used the follow code
String data="";
Calendar c = Calendar.getInstance();
data=c.getTime().toGMTString();
But Eclipse notify me that the method .toGMTString(); is…

AndreaF
- 11,975
- 27
- 102
- 168
4
votes
2 answers
how to get date from 12 hour format to 24 hour format in android
hello I have date like..
String date="09:00 AM"
But I need 09:00:00
So I use following.
String date="09:00 AM"
SimpleDateFormat f1 = new SimpleDateFormat("hh:mm:ss");
Date d1= f1.parse(date);
But it give me parse exception.
Please help me to…

Hardik Joshi
- 9,477
- 12
- 61
- 113
3
votes
1 answer
Date comparison in Android application
I have 2 dates in string format like DD/MM/YYYY. Now I have to write the condition if date1 is before date2. How can I do this? Please help me.

user993444
- 53
- 3
- 9
3
votes
1 answer
How to store file with date into SD card?
In my application I want store a file into SD card.
What I would like is that when the app stores this file, add the now date as filename and for this I wrote the below codes.
But when users change the device language to UTF-8 languages (such as :…

DJ Al
- 283
- 1
- 4
- 10
3
votes
1 answer
java TimeZone and TimeUnit and SimpleDateFormat in Android
https://gist.github.com/anonymous/e14bbbb89dd8636f1237c73dc8878b3f
I've encountered a bug in this code that causes the last switch statement (line 298 - 307) to return the default for the current day and case 0 for the next day when my emulators…

Mr.Drew
- 939
- 2
- 9
- 30
3
votes
1 answer
SimpleDateFormat provide wrong year
According to picture below, when I use item.takendate to SimpleDateFormat
I got "January 2016" instead of "January 2017"
what happen here? please advice.
Edit
However, when I use cdate parse back to Date it value is changed from 1st January to 2nd…

Jongz Puangput
- 5,527
- 10
- 58
- 96
3
votes
5 answers
Android studio - Textview show date
I've read a lot of posts about this, but I cannot get it to work.
I need a textView (id - datumprikaz ) to show the current date like this: 28.11.2016.
I've managed to add the date using this method in my java:
@Override
protected void…

Ivan
- 816
- 2
- 9
- 14
3
votes
4 answers
Security of an Android application
I am developing an Android application and I am planning to release this build in “Open Beta” on the Google Play Store.
I want to implement the app security logic which can ensure that the beta build won't work after certain date dd/MM/YYYY.…

Nimesh Chandramaniya
- 578
- 1
- 7
- 29
3
votes
1 answer
SimpleDateFormat adds 1 hour when convert UTC time to Australia time zone
I have used following code to convert UTC time to device current time zone time. It works fine on Indian Standard Time (IST). But it adds 1 hour additionally when device time zone is Sydney, Australia.
For example, I give UTC time like…

Ramprasad
- 7,981
- 20
- 74
- 135