I have a field filled in with date:
<asp:TextBox ID="txtValidadeIni" runat="server"
CssClass="form-control" MaxLength="10" type="date" name="date"
pattern="[0-9]{2}\/[0-9]{2}\/[0-9]{4}$" min="1970-01-01" max="2100-02-18">
</asp:TextBox>
When the user populates and saves a date field in sql correctly, it is saved this way: "2017-10-06" But when I try to bring this field from the bank to be shown in the form it is returning me the following error:
The specified value "2017-00-06" does not conform to the required format, "yyyy-MM-dd"
I have tried several types of formatting, but none show me the data, it follows the way I tried:
txtValidadeIni.Text = Convert
.ToDateTime(dr["data_inicio"]).ToString("yyyy-MM-dd");
How can I convert to show in this field type?