Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Time Format in datagrid (Hours, Minutes, Seconds)

Reply
Thread Tools

Time Format in datagrid (Hours, Minutes, Seconds)

 
 
Eric
Guest
Posts: n/a
 
      08-12-2004
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!
 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      08-12-2004
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


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Eric" <> wrote in message
news: m...
>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!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is time.time() < time.time() always true? flamesrock Python 8 11-24-2006 06:51 AM
covert time from date Hour min sec format to epoch time i.e time since 1 jan 1970 in C Summu82 C Programming 5 06-07-2006 02:51 PM
Format textbox to time format ruca ASP .Net Web Controls 1 05-09-2005 05:09 PM
Time/Date format and changing time to GMT Shaiboy_UK ASP .Net 0 10-18-2003 11:30 PM
Formatting a time field to 24 hour time (Military time) in the Datagrid David Hearn ASP .Net Datagrid Control 1 09-10-2003 02:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57