Is there a way to show an editor for date and an editor for time?
I'm trying to bind a datetime field to an Infragistics Date Time editor and have a Windows Date and Time Properties interface.
Hi,
WebDateTimeEditor supports any format related to date/time. You may use standard dotnet formats like "d", "t", "g", etc. or explicit formats like "HH:mm:ss", "dd/MM/yyyy", etc.
However, WebDateTimeEditor is not able to provide "pure time" like TimeSpan, but only time-portion of date. Which means that end user will see only time-fields, but application will see all fields of DateTime. If date fields are missing, then fields of current date are used. So, if you need to get time portion, then you may substract Today date from date entered by user. Codes below show 3 editors: first shows to end user only date, second-time, third-date and time (all in current culture).
<ig:WebDateTimeEditor ID="WebDateTimeEditor1" runat="server"></ig:WebDateTimeEditor> <ig:WebDateTimeEditor ID="WebDateTimeEditor2" runat="server" EditModeFormat="t"></ig:WebDateTimeEditor> <ig:WebDateTimeEditor ID="WebDateTimeEditor3" runat="server" EditModeFormat="g"></ig:WebDateTimeEditor> <asp:Label ID="Label1" runat="server"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button" />
protected void Page_Load(object sender, EventArgs e){ this.Label1.Text = "<br />" + this.WebDateTimeEditor1.Date + "<br />" + this.WebDateTimeEditor2.Date + "<br />" + this.WebDateTimeEditor3.Date;}
I need to collect date and time using webdatetimeeditor in one control and need to use 24 hour time format. the EditModeFormat ="g" uses 12 hour format and user needs to select AM and PM. How to make this control to be accepte date time like 12/31/2013 23:34? Thanks