I'm trying to put a timestamp in a dateTimePicker value in c #, I don't know if it's possible, but I'm getting an error. if is possible, I would like to put it in the format ("dd/MM/yyyy").
dateTimeDate.Value = student.date;
but i get this error,
Cannot implicitly pass the type "Google.Cloud.firestore.Timestamp" in "System.DateTime".
So i try this, but still not working.
dateTimeDate.Value = student.date.ToDateTime();
How can i fix this, and also i would like to know how to convert it to string to put in a textBox.
Firestore returns Google.Cloud.Firestore.Timestamp
object
If we convert it to string seems like:
Timestamp: 2021-04-03T10:34:48.865466Z
We can convert it to DateTime
object:
DateTime result = DateTime.ParseExact(TIMESTAMP.ToString().Replace("Timestamp:", "").Trim(),
"yyyy-MM-ddTHH:mm:ss.ffffffK", null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With