TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mayank Jani
NA
477
77.4k
How to separate time from db datetime?
Mar 29 2018 12:00 PM
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");
please note that it's C# WinApp and database is MS Access.
Thank You
Mayank Jani
Reply
Answers (
14
)
what's GlobalSuppressions.cs file in visual studio solution?
How to display output one by one in label