943,772 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 1210
  • C# RSS
Jun 19th, 2009
0

problem getting short time from an MS access database

Expand Post »
Hi
Every one.
I have an MS access database table in which i have stored a data type of date/time in short time format.
When i access the table from c# and diplay it into a data grid view the column in short time format diplay as long time format
i.e, i have stored (10:10) in data base table but in c# it display like (16/06/2009.10:10:00 AM) in data gridview
how i can get the only short time from this table?
Please any one to help me.......
Reputation Points: 10
Solved Threads: 0
Light Poster
ejazmusavi is offline Offline
42 posts
since Jun 2009
Jun 19th, 2009
0

Re: problem getting short time from an MS access database

I think you might wana consider having something like this txtDate.Text = DateTime.Today.ToShortTimeString();
in ur code, its hard to tell coz u havent post any code to see where u might be going wrong

the code above will display in a text box "12:00 AM", u can also omit AM if u want to
Last edited by Traicey; Jun 19th, 2009 at 5:42 am.
Reputation Points: 26
Solved Threads: 19
Posting Whiz in Training
Traicey is offline Offline
283 posts
since Mar 2008
Jun 19th, 2009
0

Re: problem getting short time from an MS access database

Use DefaultCellStyle.Format property.
I presume that the column number 3rd is of date datatype.
C# Syntax (Toggle Plain Text)
  1. dataGridView1.Columns[2].DefaultCellStyle.Format = "HH:mm:ss";
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Jun 19th, 2009
0

Re: problem getting short time from an MS access database

Thank You very much that was the exact solution of my problem
once again thank you
Reputation Points: 10
Solved Threads: 0
Light Poster
ejazmusavi is offline Offline
42 posts
since Jun 2009
Jun 19th, 2009
0

Re: problem getting short time from an MS access database

Thanks.
Please mark this Thread as Solved If you got suitable solution.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Statics and alot of confusion
Next Thread in C# Forum Timeline: Export datagridview data to excel





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC