I'm trying to pause a date in SQLite but it gives me the following error:
W / System.err: java.text.ParseException: Unparseable date: "Sat Feb 27 00:00:00 EST 2016" (at offset 0) 07-15 13: 32: 55.178 10245-10245 / mx.com.oncontrol.oncontrol W / System.err: at java.text.DateFormat.parse (DateFormat.java:555)
I enclose the code of my query where I thunders
public ArrayList<CXCPDetalle> ObtenerCXCPDetalle() throws ParseException {
//DateFormat DateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(new Date());
ArrayList<CXCPDetalle> ArrayDetalle = new ArrayList<CXCPDetalle>();
Cursor aRs = querySql("SELECT * FROM " + SqliteDB.DBhelper.TABLE_NAME_DETA + " WHERE " + SqliteDB.DBhelper.COLUMN_NAME_CLiente + " = " + O_Cliente.getCliente() , null);
if (aRs.getCount() > 0){
while (aRs.moveToNext())
{
CXCPDetalle detalleCxP = new CXCPDetalle(
(aRs.getInt(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_ID))),
(aRs.getString(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Folio))),
(dateFormat.parse(aRs.getString(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Fecha)))),
(aRs.getInt(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Documento))),
(aRs.getString(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_DocumentoDescripcion))),
(aRs.getInt(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_CLiente))),
(aRs.getInt(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_MOneda))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Importe))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Descuento))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_SubTotal))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Retencion1))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Retencion2))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_IEPS))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_IVA))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Total))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_SAldo))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Saldovencido))),
(aRs.getString(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_Parcialidad))),
(aRs.getDouble(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_ParcialidadTotal))),
(aRs.getString(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_PagoCondicionDescripcion))),
(aRs.getString(aRs.getColumnIndex(SqliteDB.DBhelper.COLUMN_NAME_UltimoCobroObservacion))));
ArrayDetalle.add(detalleCxP);
}
}
aRs.close();
CloseDB();
return ArrayDetalle;
}
I enclose my data insert
public void InsertarCXCPDetalle(
int Id,
String Folio,
Date Fecha,
int Documento,
String DocumentoDescripcion,
int Cliente,
int Moneda,
double Importe,
double Descuento,
double SubTotal,
double Retencion1,
double Retencion2,
double IEPS,
double IVA,
double Total,
double Saldo,
double SaldoVencido,
String Parcialidad,
double ParcialidadTotal,
String PagoCondicionDescripcion,
String UltimoCobroObservacion
)
{
Object [] CXCPDetalle = {Id,
Folio,
Fecha,
Documento,
DocumentoDescripcion,
Cliente,
Moneda,
Importe,
Descuento,
SubTotal,
Retencion1,
Retencion2,
IEPS,
IVA,
Total,
Saldo,
SaldoVencido,
Parcialidad,
ParcialidadTotal,
PagoCondicionDescripcion,
UltimoCobroObservacion};
executeSQL("INSERT INTO " + DBhelper.TABLE_NAME_DETA + " Values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CXCPDetalle);
}
I clarify that the data I get to fill the database I get from a webservice.