Time Format in datagrid (Hours, Minutes, Seconds)

E

Eric

I have a column in my database that stores total seconds. I want to
bind this colum to my datagrid. Is there a way to have the time show
as hours, minutes, and seconds without me having to build a custom
function to handle this.

The database column value is: 120 seconds

I want it to say "2 Minutes" or "0:02:00".

Any ideas?

Thanks!
 
A

Alvin Bruney [MVP]

you mean as in a setting? no. you have to handle the itemdatabound event and
do something like
DateTime time = DateTime.Parse(e.Item.Cells[index].text );
e.Item.Cells[index].text = Datelabel.Text = time.ToString("hh:mm:ss");
roughly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top