涉及时间转为字符串,然后再转时间,可能涉及“+”错误

  else if (showMethod == ShowMethod.Date)
                {
                    bool exists = sqlConfig.ResponseFieldTemp?.Field.Format != null && (sqlConfig.ResponseFieldTemp.Field.Format.ContainsKey(sqlColumn.Field));

                    if (exists)
                    {
                        name = Convert.ToDateTime(dr[sqlColumn.Alias].ToString().Replace("+"," ")).ToString(sqlConfig.ResponseFieldTemp.Field.Format[sqlColumn.Field]);
                    }
                    else if (rmt == RequestModuleType.Add)
                    {
                        name = Convert.ToDateTime(dr[sqlColumn.Alias].ToString().Replace("+", " ")).ToString(sqlColumn.AddPropertie.Format);//DateConst.DATE_FORMAT
                    }
                    else if (rmt == RequestModuleType.Edit)
                    {
                        name = Convert.ToDateTime(dr[sqlColumn.Alias].ToString().Replace("+", " ")).ToString(sqlColumn.EditPropertie.Format);
                    }
                    else if (rmt == RequestModuleType.Page)
                    {
                        name = Convert.ToDateTime(dr[sqlColumn.Alias].ToString().Replace("+", " ")).ToString(sqlColumn.PagePropertie.Format);
                    }
                    else if (rmt == RequestModuleType.List)
                    {
                        name = Convert.ToDateTime(dr[sqlColumn.Alias].ToString().Replace("+", " ")).ToString(sqlColumn.ListPropertie.Format);
                    }
                    else if (rmt == RequestModuleType.Detail && sqlColumn.DetailPropertie != null)
                    {
                        name = Convert.ToDateTime(dr[sqlColumn.Alias].ToString().Replace("+", " ")).ToString(sqlColumn.DetailPropertie.Format);
                    }

                }
文档更新时间: 2021-07-15 08:00   作者:admin