DateTime value as just Time on DataGrid

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

How do I setup the DataGridTextBoxColumn object so that a
DateTime variable only shows the time portion?
 
Set your formatting string to be {0:t} I believe... hang on lemme check
that...

<pause while I look>

Yes.. thats right

So, your textbox .text field would be
String.Format("{0:t}",
myDateTimeFieldMemberValueInfoMemberValueDotcomDotOrg)

Look up DataTimeFormatInfo class (seriously) and it will show you all the
formatting patterns

-CJ
 
How do I apply that to a DataGridTextBoxColumn?

Dim dgtbc_StartTime as New DataGridTextBoxColumn

dgtbc_StartTime.Format = "{0:t}"

doesn't work right. I was using:

Dim ltpPattern As New
System.Globalization.DateTimeFormatInfo

dgtbc_StartTime.Format = ltpPattern.LongTimePattern

but that strips the AM/PM off of my time.

Thanks
 
Hmmm... not sure why the second is stripping the AM /PM off it, have you
tried a different format and see what happens? Wish I could give better
advice than that unless you could override on the bidning (like asp.net) and
set it there, but don't knowi f you can.

-CJ
 
Back
Top