Skip to content

Commit 909ca23

Browse files
committed
improve datetime merge
1 parent 5fc18df commit 909ca23

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/FluentCommand.SqlServer/Merge/DataMergeGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ private static string GetValue(object value)
461461
return value switch
462462
{
463463
string stringValue => stringValue,
464-
DateTime dateTimeValue => dateTimeValue.ToString("u"),
465-
DateTimeOffset dateTimeOffset => dateTimeOffset.ToString("u"),
464+
DateTime dateTimeValue => dateTimeValue.ToString("yyyy-MM-dd HH:mm:ss.fff"),
465+
DateTimeOffset dateTimeOffset => dateTimeOffset.ToString("yyyy-MM-dd HH:mm:ss.ffffffzzz"),
466466
byte[] byteArray => ToHex(byteArray),
467467
bool boolValue => boolValue ? "1" : "0",
468468
#if NET6_0_OR_GREATER

test/FluentCommand.SqlServer.Tests/Snapshots/DataMergeGeneratorTests.BuildMergeDataTypeTests.verified.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
USING
33
(
44
VALUES
5-
(1, 'Test1', 0, 2, 200, 200.2, 300.35, 456.12, '2024-05-01 08:00:00Z', '2024-05-01 14:00:00Z', '00000000-0000-0000-0000-000000000000', '01:00:00', '2022-12-01', '01:30:00.000000', 0, 2, 200, 200.2, 300.35, 456.12, '2024-04-01 08:00:00Z', '2024-04-01 14:00:00Z', '00000000-0000-0000-0000-000000000000', '01:00:00', '2022-12-01', '01:30:00.000000'),
6-
(2, 'Test2', 1, 3, 400, 600.2, 700.35, 856.12, '2024-05-01 08:00:00Z', '2024-05-01 14:00:00Z', '00000000-0000-0000-0000-000000000000', '02:00:00', '2022-12-12', '06:30:00.000000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
5+
(1, 'Test1', 0, 2, 200, 200.2, 300.35, 456.12, '2024-05-01 08:00:00.000', '2024-05-01 08:00:00.000000-06:00', '00000000-0000-0000-0000-000000000000', '01:00:00', '2022-12-01', '01:30:00.000000', 0, 2, 200, 200.2, 300.35, 456.12, '2024-04-01 08:00:00.000', '2024-04-01 08:00:00.000000-06:00', '00000000-0000-0000-0000-000000000000', '01:00:00', '2022-12-01', '01:30:00.000000'),
6+
(2, 'Test2', 1, 3, 400, 600.2, 700.35, 856.12, '2024-05-01 08:00:00.000', '2024-05-01 08:00:00.000000-06:00', '00000000-0000-0000-0000-000000000000', '02:00:00', '2022-12-12', '06:30:00.000000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
77
)
88
AS s
99
(

0 commit comments

Comments
 (0)