Hello, what can i do to convert a date that is dd/mm/yyyy to yyyy-mm-dd?
public static Paginacao<Solicitacao> PaginarParaLote(int paginaAtual = 0, int itensPorPagina = 20, int? TipoId = null, long? ProtocoloId = null, int? StatusId = null, DateTime? DataSolicitacaoInicio = null, DateTime? DataSolicitacaoFim = null)
{
StringBuilder strWhere = new StringBuilder();
if (TipoId != null)
{
strWhere.AppendFormat(" AND TipoId = {0} ", TipoId);
}
if (ProtocoloId != null)
{
strWhere.AppendFormat(" AND ProtocoloId = {0} ", ProtocoloId);
}
if (StatusId != null)
{
strWhere.AppendFormat(" AND StatusId = {0} ", StatusId);
}
if (DataSolicitacaoInicio != null)
{
if (DataSolicitacaoFim != null)
{
strWhere.AppendFormat(" AND DataInicioSolicitacao BETWEEN '{0}' AND '{1}'", DataSolicitacaoInicio.Value.ToShortDateString(), DataSolicitacaoFim.Value.ToShortDateString());
}
else
{
strWhere.AppendFormat(" AND DataInicioSolicitacao > {0} ", DataSolicitacaoInicio.Value.ToShortDateString());
}
}
strWhere.AppendFormat(" AND Id NOT IN(SELECT SolicitacaoId FROM [Lote.Solicitacoes])");
return PaginarWhere(paginaAtual, itensPorPagina, " Id ", strWhere.ToString());
}
Thanks