Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting time on a BoundColumn of a DataGrid - just time 1

Status
Not open for further replies.

TeaAddictedGeek

Programmer
Apr 23, 1999
271
US
I'm trying to get just the time value from a BoundColumn in a DataGrid. Usually the expressions are like this:

DataFormatString="{0:d}"

Which would get me the short date. But what if I just want the time part of the DateTime? As in, hours and minutes?


Thanks!

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
Never mind, just figured it out. Here it is for the curious:

DataFormatString="{0:HH:mm}"



"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
I just need hours and minutes, not seconds. But I'll keep that info handy. Thanks!

"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
 
Just drop the ":ss" from my example then. The original method you used is a shorthand version of referring to server specific settings. You can use the method I described to write out any format you need.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top