Higuys,
I have a Textbox where user choose a date (MM/dd/yyyy) and another TextBox where choose inserts time (hh:mm).
<tr>
<td>
<asp:Label ID="Label1" runat="server" CssClass="cp_title">Event Date:</asp:Label>
</td>
<td>
<asp:Label ID="Label2" runat="server" CssClass="cp_title">Event Time(hh:mm):</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtEventDate" runat="server">
</asp:TextBox>
<cc1:CalendarExtender ID="cldEventDate" runat="server" TargetControlID="txtEventDate"
PopupPosition="BottomLeft" Format="MM/dd/yyyy">
</cc1:CalendarExtender>
</td>
<td>
<asp:TextBox runat="server" ID="txtEventTime"></asp:TextBox>
</td>
</tr>
In the database I have a single column for DateTime so I have to “concatenate” the user input into a real datetime format…
I see a constructor for DateTime which takes as args: year, month, day, hour, minute, second, but this requires me to parse user input and split in these periods….
Do you know an easier solution?
You can use
DateTime.ParseExact():