Category : date

I have Calendar value which is from Date Picker and I want to convert this value to String format "yyyy-MM-dd" This is my Date Picker code. I save the selected values to startYear, startMonth and startDay. ipDcEventStartDay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v){ DatePickerDialog dpd = new DatePickerDialog(DoubleCheckEventActivity.this, new DatePickerDialog.OnDateSetListener() { @Override public void ..

Read more

I want to get days between today and birthday Today Date currentDate = Calendar.getInstance().getTime(); SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); String currentString = formatter.format(currentDate); return currentString; birthday: String date = dayOfMonth + "/" + month + "/" + year; datePicker1.setText(date); Calendar calendar1 = Calendar.getInstance(); calendar1.set(Calendar.MONTH,month +1); calendar1.set(Calendar.YEAR,year); calendar1.set(Calendar.DAY_OF_MONTH,dayOfMonth); CharSequence datecharSequence = DateFormat.format("dd/MM/yyyy",calendar1); Calculation: String firsDate = ..

Read more

I am trying to set the date of a post in the firebase database in a "Text View", but I am having difficulties. Note: I am using RecyclerView. This is a part of my code in CommentAdapter public void onBindViewHolder(@NonNull final CommentAdapter.ImageViewHolder holder, final int position) { firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); final Comment comment = mComment.get(position); ..

Read more

I tried so many Codes but failed Is there is any library or can we do this with an android studio built-in date picker? This is my last tried code Calendar today = Calendar.getInstance(); Calendar twoDaysAgo = (Calendar) today.clone(); twoDaysAgo.add(Calendar.DATE, -2); Calendar twoDaysLater = (Calendar) today.clone(); twoDaysLater.add(Calendar.DATE, 2); datePicker.setMinDate(twoDaysAgo.getTimeInMillis()); datePicker.setMaxDate(twoDaysLater.getTimeInMillis()); Source: Android..

Read more

I organize the data from my adapter file according to the user’s time. However, this process is running very slow and I get a lot of system.error errors on the console. I could not find how to fix this error. The database model I use; https://prnt.sc/10i8b98 private void convertTimeZone() { for (int i = 0; ..

Read more

I am having a method which formats my particular data string public static String dateFormatter(String dateToFormat){ SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd", Locale.UK); // All the fields in dateFormatter must be in dateParser SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy, MMM d, EEE", Locale.UK); Date date = new Date(); try { date = dateParser.parse(dateToFormat); } catch (ParseException e) ..

Read more