Skip to content

Commit

Permalink
SqlServer时间格式化问题,不支持{ts'yyyy-MM-dd'}、{ts'yyyy-MM-dd HH:mm:ss.fffffff'…
Browse files Browse the repository at this point in the history
…},直接转换字符串不带{ts}
  • Loading branch information
ligengrong committed Jun 11, 2024
1 parent 310c19b commit c395eb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions XCode/DataAccessLayer/Database/SqlServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,12 @@ public override String FormatDateTime(IDataColumn column, DateTime dateTime)
if (dateTime.Ticks % 10_000_000 == 0)
{
if (dateTime.Hour == 0 && dateTime.Minute == 0 && dateTime.Second == 0)
return $"{{ts'{dateTime:yyyy-MM-dd}'}}";
return $"'{dateTime:yyyy-MM-dd}'";
else
return $"{{ts'{dateTime:yyyy-MM-dd HH:mm:ss}'}}";
}
else if (column != null && column.RawType.EqualIgnoreCase("datetime2"))
return $"{{ts'{dateTime:yyyy-MM-dd HH:mm:ss.fffffff}'}}";
return $"'{dateTime:yyyy-MM-dd HH:mm:ss.fffffff}'";
else
return $"{{ts'{dateTime:yyyy-MM-dd HH:mm:ss.fff}'}}";
}
Expand Down

0 comments on commit c395eb8

Please sign in to comment.