Currently I made a form for the user to select the symptoms that they present, these symptoms are stored in firestore along with the date on which the data was saved, what I want is that when displaying this data the date appears and if I mate but not with the format as it is in firestore, I will place a photo of how it is in firestore and how it shows me in the app.
DateTime dateTime = DateTime.now();
DateTime dateTime = DateTime.now();
void _showDatePicker() {
showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(2000),
lastDate: DateTime(2025),
).then((value) {
setState(() {
dateTime = value!;
});
});
}
Here I store them:
ElevatedButton(
onPressed: () async {
await users.add({
'Fatiga': fatiga,
'Miccion': miccion,
'Flujo Vaginal': flujoVaginal,
'Estreñimiento': estrenimiento,
'Acidez Gastrica': acidezGastrica,
'Sangrado Nasal': sangradoNasal,
'Sangrado de encias': sangradoEncias,
'Hinchazon': hinchazon,
'Problemas respiratarios': problemasRespiratorios,
'Fecha ingreso sintoma': dateTime
}).then((value) => (value) => print('User added'));
},
child: Text("Guardar"))
This is where I generate the date and store it.
ListView.builder(
itemCount: data.size,
itemBuilder: (context, index) {
return Text('''
'Los sitomas que presenta son:
Fatiga: ${data.docs[index]['Fatiga']}
Acidez Gastrica: ${data.docs[index]['Acidez Gastrica']}
Fecha de sintoma: ${data.docs[index]['Fecha ingreso sintoma']}
''');
And this is where I show it.
Here is how it is saved in firestore.
But in the app it shows me like this: