Questions tagged [android-date]
276 questions
0
votes
1 answer
Calculate the time difference between two days of current week on Android
I would like to calculate the time difference between two days (e.g. Friday and Saturday) of the same week. This sort of calculation is required for validating a time restriction of my project. To understand more about the restriction see the below…

Purple Lotus
- 129
- 15
0
votes
4 answers
NumberFormatException: Invalid int: "HH"
I get the error Invalid int:"HH". It only occurs on some devices. I think the problem is in the conversion , but why does it work on most devices ?
This is the logcat:
java.lang.NumberFormatException: Invalid int: "HH"
at…

Rivas202
- 215
- 2
- 8
0
votes
0 answers
Difference between 2 date objects in days
I am doing an android project and I have 2 date objects
Fri Apr 17 00:00:00 GMT+05:30 2015
Thu Apr 16 21:12:27 GMT+05:30 2015
Here difference b/w these 2 dates is not 24 hrs, but as the day changes from Thu to Fri I need the difference as…

user2085965
- 393
- 2
- 13
- 33
0
votes
1 answer
Execute code in a specific date using date stored in a database
I've stored a date in a database, but if now I want to execute some code when the date stored is equal to the corrent date on the device? The date format is : MM/DD/YYYY , if for example the date stored is 03/14/2015 and I need to execute code in…

Slaiv206
- 309
- 2
- 14
0
votes
5 answers
How to convert String to Date which can be store in database?
I use a DataPicker and in the method onDateSet(DatePicker view, int year, int monthOfYear,int dayOfMonth) I get year , monthOfYear and dayOfMonth, how I can merge this 3 int in a single Date which I can use to store in a database?

Slaiv206
- 309
- 2
- 14
0
votes
2 answers
Convert Tue Dec 09 00:00:00 GMT+04:00 2014 to yyyy-MM-dd android
The code below produces error Caused by: java.lang.NullPointerException
at java.util.Calendar.setTime. Is it the right way to convert
"Tue Dec 09 00:00:00 GMT+04:00 2014" to yyyy-MM-dd android using simpledateformat
SimpleDateFormat…

Dimitri
- 1,924
- 9
- 43
- 65
0
votes
3 answers
Parse date milliseconds to days,hours,minutes
I'm trying to get parse a string to date, and after that to get the days, hours & minutes from the milliseconds. I'm parsing this string to date:2015-03-01 00:00:00, and that I'm doing with this code:
DateFormat dateFormat = new…

Darko Petkovski
- 3,892
- 13
- 53
- 117
0
votes
3 answers
Parse date from string to get milliseconds
I'm trying to get the milliseconds from an string that contains a date, but seems that I'm getting the wrong value. This is the string im trying to parse: 2015-03-01 00:00:00,
I'm doing this to parse it:
DateFormat dateFormat = new…

Darko Petkovski
- 3,892
- 13
- 53
- 117
0
votes
2 answers
Date Formatting using only date and month?
I need to construct a date which will display only day and month example:- 23 Dec . I have day value and month value only but how do I use SimpleDateFormat to construct a formatted date with format like "dd-MMM".How do I modified the below method to…

Anshul
- 7,914
- 12
- 42
- 65
0
votes
1 answer
dealing with Date and Time separately
I want to deal with date and time separately in my android app, by saying separately I mean setting the time without affecting the date and vice versa, So, when setting the time only:
Calendar calendar = Calendar.getInstance();
…

Muhammed Refaat
- 8,914
- 14
- 83
- 118
0
votes
3 answers
How to get the Time like facebook post eg. 1sec ago or 3hrs ago, In android application
I have developed an application where the user receives the message from other application user. I want to just show the time like Facebook, eg. 1sec ago or 3Hrs ago. Something in this fashion. I tried a code from one of our Fellow S.O expert but…

Mayank
- 165
- 1
- 5
- 20
0
votes
1 answer
android date format: How to convert date in alphabets
How can I convert this date 26-11-2013 in this format nov 26. I have tried many things but didn't work for me. Like
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
String dateInString = "26-11-2013";
Date date =…

Abid Khan
- 2,451
- 4
- 22
- 45
0
votes
1 answer
Android event that occurs on every start of new day until some end date
I am developing an application for a certain event like a count down.
In the foreground of the app I show the days, hours, minutes and seconds left till the event date/time with handler.
However, I'd like to be able to detect start of new day (when…

Speed Demon
- 691
- 1
- 9
- 21
0
votes
2 answers
Should I set timezone to convert string to date?
I convert string to date like this:
String date = Date_.get(position).substring(0,19);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date testDate = null;
try {
testDate = sdf.parse(date);
}catch(Exception ex){
…

CompEng
- 7,161
- 16
- 68
- 122
0
votes
3 answers
SimpleDateFormat.parse() converts DTstring to local time. Can be converted to source's time?
I have followed this SO answer for datetime conversion of 8601.
I will cite an example straight from w3 :
1994-11-05T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time.
1994-11-05T13:15:30Z corresponds to the same…

Diolor
- 13,181
- 30
- 111
- 179