I would like to show a query for the current date, because when I save in my table I have the field fecha
and it is type date
.
The format to show and save the date is this:
void cargar() {
Calendar cal = new GregorianCalendar();
int anio=cal.get(Calendar.YEAR);
int mesi=cal.get(Calendar.MONTH);
int mest=mesi+1;
int mes=mest;
int dia=cal.get(Calendar.DATE);
String fecha= anio+"-"+mes+"-"+dia;
this.lab_fecha.setText(fecha);
}
I'm doing the query like this but it still shows me all the dates, and what I want to achieve is to show me only the records that have a date of today.
SQL = "SELECT * FROM adelantos WHERE fecha ORDER BY fecha DESC,hora DESC";