>
Olá,
tenho uma listview usando um SimpleCursorAdapter, trazendo data que está no SQLite como text e apresentando YYYY-MM-DD 00:00:00.0
como apresentar esta data como DD-MM-AAAA ou DD/MM/AA ?
Ola Heric
tente fazer assim
select strftime('%d-%m-%Y', Nome do campo )
André,
"...
GerBaseActivity gerenciador;
Cursor c;
gerenciador = new GerBaseActivity(this);
c = gerenciador.recObterTodos(filtro);
String[] from = { "rec_dt_venc", "valor", "rec_car", "fpg_forma" };
int[] to = { R.id.txvDupVct, R.id.txvDupValor, R.id.txvDupCar,
R.id.txvDupForma };
android.widget.SimpleCursorAdapter ad = new android.widget.SimpleCursorAdapter(
getBaseContext(), R.layout.activity_dup_linha, c, from, to);
ListView ltwDados = (ListView) findViewById(R.id.ltwDup);
ltwDados.setAdapter(ad);
..."
Veja que estou passando os campos do sqlite direto para o SimpleCursorAdapter, onde aplicar o select que sugeriu?
esse GerBaseActivity é o q??
mostre essa classe,por favor???
é a classe de acesso ao sqlite.
"...
public class Classe_GerBase extends SQLiteOpenHelper {
private static final String NOME_BANCO = "bdDigSVM.db";
private static final int VERSAO_SCHEMA = 1;
public Classe_GerBase(Context context) {
super(context, NOME_BANCO, null, VERSAO_SCHEMA);
}
..."
"...
public Cursor recObterTodos(String filtro) {
if (filtro == "") {
return getReadableDatabase().rawQuery(
"select _id, rec_car, rec_dt_venc, cli_cod, valor, "
"fpg_forma FROM receber ORDER BY rec_dt_venc",
null);
} else {
return getReadableDatabase().rawQuery(
"select _id, rec_car, rec_dt_venc, cli_cod, valor, "
"fpg_forma FROM receber where cli_cod = '"
filtro "' ORDER BY rec_dt_venc", null);
}
}
..."
vai ser ai nessa parte q vc vai colocar
select _id, rec_car, strftime('%d/%m/%Y', rec_dt_venc ) ..................
Perfeito, obrigado!