Questions tagged [android-dateutils]
51 questions
1
vote
1 answer
Android how to convert this format(/Date(1418346257000+0700)/) to Date object
The web service returns me the format like this /Date(1418346257000+0700)/. How can I convert it to Date object.

Binh Nguyen
- 71
- 6
1
vote
1 answer
Parsing RSS pubDate in Android slow with SimpleDateFormat
I need to parse pubDate from RSS feeds in an Android App. Unfortunately, the pubDate is formatted differently in different RSS feeds (e.g. EEE, dd MMM yyyy HH:mm:ss z, yyyy-MM-dd'T'HH:mm:ss.SSSz...)
I have found a solution to parse most different…

jeff_bordon
- 392
- 4
- 16
0
votes
1 answer
Will Android DateUtils.getRelativeTimeSpanString format relative past datetimes to required statements
In my current Android project I have a requirement to display historical string datetimes that have the following format/value examples
2023-01-06T14:52:41.633
2023-01-06T00:00:00
2022-12-23T00:00:00
2022-12-22T11:17:43.94
into string "phrases"…

Hector
- 4,016
- 21
- 112
- 211
0
votes
1 answer
Get a dateTime before some hours from a specified dateTime Kotlin Android
I want to get a dateTime which is some hours before the specified datetime. The datetime will be in string format and depending on configuration, need a datetime n hours before the given time( example 3 or 4 hours before the given time).
The time…

Joseph
- 1,060
- 3
- 22
- 53
0
votes
1 answer
How do I check if current time and a custom time are within device time slot (wall clock time) of 30 mins
I have a unique issue where I have to determine 2 things.
1) if my current time and a custom time are within the same 30 min time slot ( say its 2:10pm and the custom time is 2:22pm , I want to see they are within the same time slot from 2 to 2:30…
user11455292
0
votes
1 answer
String to Date object in Android
I have two string values in one key for the date
Case 1 : date can be a string value ="2010-10-15T09:27:37Z"
Case 2 : and sometimes it can be a "20130526160000"
but I have only one function to parse these two value into date object
how can i…

Mahi
- 1,754
- 2
- 16
- 37
0
votes
0 answers
DatePickerObject.setMinDate() is not working within OnDataChanged() in android in second or third times
In DatePicker, on DataChanged callback when I select weekends either saturday or sunday,I am programatically changing the date to upcoming monday/tuesday using view.setMinDate(expectedDay). During initial press 2 or 3 times, it works correctly. By…

Rakesh
- 14,997
- 13
- 42
- 62
0
votes
2 answers
DateUtils.getRelativeTimeSpanString returns the difference in time but result includes the current time
CharSequence string = DateUtils.getRelativeDateTimeString(getActivity(), System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS,
DateUtils.DAY_IN_MILLIS, DateUtils.FORMAT_ABBREV_RELATIVE);
Result is "0 min ago, 00:19" i only need the "0…

johnson
- 111
- 11
0
votes
1 answer
if else statement for DateUtils
So before this I already get the time difference between two times.
Now, I want to display point that will be charged for specific time duration like this:
in my code, time duration named as diffResult,
if diffResult less than 30 minutes, point…

Nor Sakinah
- 49
- 8
0
votes
1 answer
DateUtils.getRelativeTimeSpanString Returning a Formatted Date String Instead of "Hours/Minutes Ago"
I'm having fierce problems trying to get DateUtils.getRelativeTimeSpanString to return what it's supposed to in Android.
I've been through every similar question here and none of the solutions posted are working or relevant.
Here's my…

Dave Davis
- 844
- 1
- 9
- 19
0
votes
0 answers
Date is not working in TextView when switched between tabs and app gets down when navigation is used
When I switch between my tabs the date won't show. I have searched for other methods for showing date with the help of textview but most of them didn't work. Only the method of thread worked for me but it has an issue that it doesn't show date in…

divine_rythm
- 149
- 3
- 9
0
votes
1 answer
How to force minutes in DateUtils#getRelativeTimeSpanString(long, long, long)?
My app has a 0 - 120 minute picker. I want to display the time like this: "In ... minutes".
I found the method DateUtils#getRelativeTimeSpanString(long, long, long) and it works correctly for values under 60 minutes. However, if the value is 60…

Thomas Vos
- 12,271
- 5
- 33
- 71
0
votes
1 answer
Incorrect date conversion
Today is 5th of May. Following code should output 11th of April and 10th of April. Instead I get 11th of April and 29th of May. Here is the code:
int daysBack = 24;
long dayBeginningMilis = getTodaysBeginningMilis() - 86400000 * daysBack;
…

wilkas
- 1,161
- 1
- 12
- 34
0
votes
1 answer
How to display date/time according to device settings
I simply want to display a date/time according to device locale and settings like 12h/24h mode.
Having take a look at several posts here on SO, I finally tried to use this:
long millis = this.startDate.getTime();
if…

fralbo
- 2,534
- 4
- 41
- 73
0
votes
2 answers
Android - How to parse this date [ 2014-04-23T14:20:00.000-07:00 ]?
I want to convert this date format :
2014-04-23T14:20:00.000-07:00
into a date object so I can use this method to get the difference :
DateUtils.getDateDifference(DATE_OBJECT);
...
I've tried using 'SimpleDateFormat' but it throws an exception,…

Alaa Salah
- 1,047
- 3
- 12
- 28