Hi members,
Greetings of the day...
a time field in my Access db table, log in time is recorded as '10:30 AM' but when I fetch the record to a DGV, it shows as '30/12/1899 10:30 AM' !!!
I am surprising why the date is showing of the year 1899. the data type is date/time and format is Medium Date' the time data also being saved as mentioned above but the out put in DGV shows with date. I want it to be displayed as it is in the db.
I have found some functions that separates/extracts time from the date but the display remains the same.
DateTime dt = DateTime.Now;
string CONVdt = dsFetchAppo.Tables[0].Rows[0].ItemArray[3].ToString();
DateTime.TryParse(CONVdt, out dt);
string CONVtime = dt.ToString("H:mm tt");
string CONVdt = dsFetchAppo.Tables[0].Rows[0].ItemArray[3].ToString();
DateTime.TryParse(CONVdt, out dt);
string CONVtime = dt.ToString("H:mm tt");
please note that it's C# WinApp and database is MS Access.
Thank You
Mayank Jani

Amit GuptaRank #190 · 12.8K reputationPosted Apr 2, 2018, 9:48 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Mar 30, 2018, 3:47 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Mar 30, 2018, 5:41 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Apr 2, 2018, 9:20 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Apr 2, 2018, 9:20 AM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Apr 2, 2018, 10:15 PM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Mar 29, 2018, 8:34 AM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Mar 30, 2018, 4:02 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Apr 2, 2018, 4:54 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Apr 2, 2018, 4:57 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Apr 2, 2018, 7:06 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Apr 2, 2018, 8:52 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Apr 3, 2018, 3:46 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Apr 3, 2018, 3:48 AM EDT