Questions tagged [android-date]

276 questions
-1
votes
1 answer

Error While creating Date Picker in Android?

i got this error while creating date picker in android "Syntax error on tokens, AnnotationName expected instead" public class Insert extends Activity { private Header header; private EditText etName; private EditText etAge; …
Smith
  • 11
  • 2
-1
votes
1 answer

cant subtract 2 timstamp long values

i'm trying to subtract two long(timestamp) but it kept crashing the application heres the code //converting timestamp to actual time; val calendar = Calendar.getInstance(Locale.ENGLISH) calendar.timeInMillis =…
-1
votes
3 answers

Parse the String to Date and format

In the fragment I have a DatePickerDialog.OnDateSetListener. If I choose a Date, I send it to the presenter in the form of a String. Then I want to parse String to Date in Presenter and before save in the database change the format of…
beginner992
  • 659
  • 1
  • 9
  • 28
-1
votes
1 answer

How do I get the time an hour from now for my 12 hour time format in string?

I am planning to add an hour to the current time, which I have converted into a 12 hour format. Just not sure how to go about it. I want to keep mins the same, just want to add an hour, say the time is 11:59am -> I would like to show 12:59pm, or if…
user2386226
-1
votes
2 answers

How do I convert my date string to a custom date format?

I am currently working on creating a custom date format such that it is supposed to show as "Monday, April 8, 2019 " but whenever I pick from dialog and apply simple date format, it returns the date with abbreviated month and time (which I don't…
user2386226
-1
votes
1 answer

Calculate the difference between Current Date and Past Date

Experts, trying to show the difference between two dates in Android Studio. Have got following conditions. Below Condition number one is working fine. 1. Difference between current date vs future date Condition 2 has issue were it shows the value…
Leace
  • 262
  • 1
  • 7
  • 24
-1
votes
1 answer

Getting Wrong time after converting Server time to Local Time

I am receiving time from server in this format: 2018-04-04T08:41:21.265185Z I have converted this time to local time. But after conversion the time I am getting time one hour more than the cctual current time. This is code for time…
Satyam Gondhale
  • 1,415
  • 1
  • 16
  • 43
-1
votes
3 answers

How to get previous 7 dates from a particular date in java?I am getting 7 dates from present date, but I want from particular date

//explain public class DateLoop { static String finalDate; static String particularDate; public static void main(String[] args) { // TODO Auto-generated method stub SimpleDateFormat sdf = new SimpleDateFormat("d-M-yyyy…
-1
votes
1 answer

Get 24-hours format

I am converting timestamp to Solar Hijri and good work like bellow : private String getDate(long timestamp) { Date date = new Date(timestamp * 1000L); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/HH:mm", Locale.UK); …
user4813855
-1
votes
3 answers

Android - Show Date in textView error

So I created a Navigation Drawer Activity and some fragments. On one fragment I have a textView in which I need to show the date like dd.MM.yyyy I managed to do this on a different app using: //show date TextView datumprikaz =…
Ivan
  • 816
  • 2
  • 9
  • 14
-1
votes
1 answer

Java Date representation difference

Is the formatter representation "yyyy-MM-dd HH:mm:ss.sss" is correct way to format the date. Note that here I've used small 's'(instead of capital 'S') to indicate milliseconds which results wrong time. If yes what is the difference between…
sravanalakshmi.sunkara
  • 1,161
  • 2
  • 13
  • 35
-1
votes
2 answers

Determine whether time from hh:mm:ss to hh:mm:ss is am,pm, or both java

I have 2 time string i.e. "from" and "to" time. Example: String from= "05:30:22"; String to ="14:00:22"; How can i determine if the time from to to value is am pm or both using calendar format. My workings : I get the hour: agenda_from_hour =…
Dimitri
  • 1,924
  • 9
  • 43
  • 65
-1
votes
2 answers

How to perform daily monthly yearly data updates

I want to implement a method to perform periodic updates public void periodicUpdate(int frequence){ //frequence 1 daily, 2 monthly, 3 yearly switch(frequence){ case 1: if(aDayIsExpired()){ …
AndreaF
  • 11,975
  • 27
  • 102
  • 168
-1
votes
1 answer

Comparing the dates in a custom Adapter class (Null Pointer Exception)?

I have a custom adapter. I try to compare the current date and the entered date in it. But ı got null pointer exception. I can't figure out why is the reason of this exception. My LogCat is below and the line with the problem is that "((ViewGroup)…
cgbs
  • 83
  • 3
  • 13
-1
votes
3 answers

How to show the Calender of only one year from current date in Android?

I want that the calender show user only one year date and rest will be disabled for the past it is working fine .But now i want to make so that the user can select only one year calender from current date.here is my code .Please suggest me the…
Developer
  • 6,292
  • 19
  • 55
  • 115