Skip to content

Commit

Permalink
Creating UTC timestamp when exporting datetime to josn
Browse files Browse the repository at this point in the history
  • Loading branch information
dei79 committed Nov 10, 2023
1 parent adf690c commit 97109fb
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task ExportToJsonAsync(string tableName, TextWriter writer, Action<

// build the json writer
JsonWriter wr = new JsonTextWriter(writer);

// prepare the array in result
wr.WriteStartArray();

Expand Down Expand Up @@ -63,7 +63,17 @@ public async Task ExportToJsonAsync(string tableName, TextWriter writer, Action<
wr.WritePropertyName(TableConstants.PropertyType);
wr.WriteValue(propertyKvp.Value.GetType().GetEdmPropertyType());
wr.WritePropertyName(TableConstants.PropertyValue);
wr.WriteValue(propertyKvp.Value);

switch (propertyKvp.Value.GetType().GetEdmPropertyType())
{
case ExportEdmType.DateTime:
wr.WriteValue(((DateTime)propertyKvp.Value).ToUniversalTime());
break;
default:
wr.WriteValue(propertyKvp.Value);
break;
}

wr.WriteEndObject();
}
wr.WriteEnd();
Expand Down

0 comments on commit 97109fb

Please sign in to comment.