How can I convert the date correctly? without this message coming out

0
  

Unable to convert an object of type   'System.Web.UI.HtmlControls.HtmlInputGenericControl' to the type   'System.IConvertible'

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CapaEntidades;
using CapaLogicaNegocio;

namespace CapaPresentacion
{
    public partial class NuevaSeccionEnterate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)

        {
            if (!Page.IsPostBack)
            {
                //Registro Del Nuevo Foro Enterate

                Enterate objEnterate = GetEntity();

                //Enviar A CapaLogicNegocio

            }
        }

        public Enterate GetEntity()

        {
            Enterate objEnterate = new Enterate();
            objEnterate.Id_ent = 0;
            objEnterate.titu_ent = nuevotitulo.InnerText;
            objEnterate.cod_img_ent = imagensection.InnerText;
            objEnterate.parf_ent = nuevoparrafo.InnerText;
            objEnterate.fech_art_ent = Convert.ToDateTime(fechapublicacion);
            return objEnterate;
        }




    }
}
    
asked by Izhoka Perez 26.11.2018 в 15:33
source

1 answer

0

You can specify what type of publication date, or try:

DateTime.ParseExact (publicationdate.ToString (), "yyyy-MM-dd", CultureInfo.InvariantCulture)

    
answered by 29.11.2018 / 23:28
source