Questions tagged [android-date]

276 questions
3
votes
3 answers

select date of birth dialog

How to create alert dialog that I can select date of birth: I want that it's not be impossible to choose date in future. How could set limits in date dialog Here is my code @Override protected Dialog onCreateDialog(int id) { switch (id)…
pmb
  • 2,327
  • 3
  • 30
  • 47
3
votes
0 answers

Date Slider with current date selected

I am trying to make the UI for date Slider with date selection by the small arrow below. How to go about it. Any help ? Since the dates I will show would be of an array. Should I go with ListView.
3
votes
4 answers

Display Date in 24-hour issue

I am working simple app where I can get current DateTime and convert that into 24-hour format. Code: String DATE_yyyy_MM_dd_hh_mm_ss = "yyyy-MM-dd hh:mm:ss"; String DATE_yyyy_MM_dd_HH_mm_ss = "yyyy-MM-dd HH:mm:ss"; TextView…
M D
  • 47,665
  • 9
  • 93
  • 114
3
votes
4 answers

Date Format's getLongDateFormat() isn't displaying the day of the week

I've created a private method to receive a Date, and format it so it looks like "Sunday, August 10, 2014": private String formatDate(Date date){ java.text.DateFormat dateFormat =…
Marina
  • 3,222
  • 5
  • 25
  • 35
3
votes
8 answers

Find number of days, weeks, months and year between two milliseconds.

I need to set events in my custom calender which will repeat according to selected period i.e, daily, weekly, monthly or yearly. I have start and end dates in milliseconds. Question: Is there any Calender or Date API from which we can calculate…
Akhilesh Mani
  • 3,502
  • 5
  • 28
  • 59
3
votes
4 answers

Comparing times: Check if a given time is within a certain amount of time of the another

As the title states; Is there a way to compare times to see if they are within a certain amount of time of each other? Ie. a way to tell if Time1 is within 15 minutes of Time2. A more complicated example might be within 75 minutes (because the…
user2442638
3
votes
5 answers

How to get only the year from DateUtils

How do i get only the year part of a date using DateUtils ? I tried using DateUtils.FORMAT_SHOW_YEAR but this seems to return even the month and date.
lokoko
  • 5,785
  • 5
  • 35
  • 68
3
votes
0 answers

add title to datepicker holiday array

Is there a way to add custom titles to the array so that each holiday has it's own title instead of the generalized Date Unavailable? var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]; var unavailableDates…
2
votes
4 answers

Remaining days to a date is not showing correctly

Ok, so I've created a function to show the number of days until a date in the future... It is correct until the amount of days is over 9 days.. if over it seems to show a random number of days... Please see my code below: public String…
2
votes
0 answers

How to clear shared preferences value based on daily basis

I am working on an android project where I have a scenario such as : Task 1: I have to get the user activity count "when ever the user starts the activity a count has to be made and stored in shared preference. (completed successfully) Task 2: I…
2
votes
2 answers

Get default timezone in android

I need to get local time in my app. I am using Calendar class for this purpose. Code : Calendar calendar = Calendar.getInstance(); calendar.get(Calendar.HOUR_OF_DAY) shows the hours according to GMT. I checked that…
arora
  • 21
  • 3
2
votes
2 answers

DateFormat produce wrong year

The above picture is the date picker, after I click OK, the result is shown below. The code is as follow public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { @Override public Dialog…
Andrew Lam
  • 3,675
  • 4
  • 23
  • 34
2
votes
3 answers

How can I setMaxDate() for DatePicker to one month after the current date?

Here's my onCreateDialog: DatePickerDialog dialog = new DatePickerDialog(this, dpickerListener, year_x, month_x, day_x); dialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000); dialog.getDatePicker().setMaxDate(); As…
2
votes
2 answers

How to get day,hours,minutes to reach a certain date

I need to get Day Hours Minutes to reach certain date example : Date = "14-08-2015 16:38:28" Current_Date = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()); and to reach that Date the result will be 2 Days and 1 hour and 30…
2
votes
2 answers

How to read particular number of one month messages android?

I want to read the messages of particular number in a particular time. For example i want to read the before one month messages of "+91934345432".( For example today aug 6th so i need the messages in between july 6th to aug 6th. ) my code:…
kartheeki j
  • 2,206
  • 5
  • 27
  • 51