Print Page | Close Window

Displaying Time

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=830
Printed Date: 24-Mar-2025 at 10:24pm


Topic: Displaying Time
Posted By: BillG
Subject: Displaying Time
Date Posted: 06-Jun-2008 at 12:39pm
I have a datetime field in my SQL Server Table called StartTime.  When I display the field on a form, I just want to display the time portion of the field in a DateTimePicker?  The user can change the start time and then I want to save it back to the table. 
 
How do I bind this field to my form so that only the time displays?
 
Bill
 



Replies:
Posted By: davidklitzke
Date Posted: 06-Jun-2008 at 3:37pm
Right-click the ControlBindingManager, and choose "Configure DataBinding".  Change the Data Converter for StartTime to DateConverter (1 of three possible choices).  Set the Format String in the DateConverter Properties menu to "T" or "t".
 
For more information on Format strings, see:
 
http://john-sheehan.com/blog/wp-content/uploads/msnet-formatting-strings.pdf - http://john-sheehan.com/blog/wp-content/uploads/msnet-formatting-strings.pdf
 
or
 
http://blogs.msdn.com/kathykam/archive/2006/03/29/564426.aspx - http://blogs.msdn.com/kathykam/archive/2006/03/29/564426.aspx
 



Print Page | Close Window