1

Click here to see image

I want to make sure that time is not same.

It's an appointment booking app, so it cannot be the same.

public void clients()
{
    String name=t2.getText().toString().trim();
    String gender=t1.getText().toString().trim();
    String barber=t4.getText().toString().trim();
    String dt=t5.getText().toString().trim();
    String concerng=t6.getText().toString().trim();

    if(!TextUtils.isEmpty(name) || !TextUtils.isEmpty(gender) || !TextUtils.isEmpty(barber) ||  !TextUtils.isEmpty(dt) || !TextUtils.isEmpty(concerng))
    {
        String id=databaseReference.push().getKey();
        client client=new client(id,name,gender,barber,dt,concerng);

        databaseReference.child(id).setValue(client);
        Toast.makeText(this, "", Toast.LENGTH_SHORT).show();
    }
    else
    {
        Toast.makeText(this, "Something Went Wrong Please Check Again", Toast.LENGTH_SHORT).show();
    }
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Akash Nair
  • 27
  • 8

1 Answers1

0

To be able to compare two dates, you need to store the values of the cdatetime property as a timestamp and not as a String, as I see in your database now. Here you can find how to add and retrieve a timestamp from a Firebase database. If you follow those steps, you'll be able to compare very easy two long primitives.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193