Skip to content

Commit

Permalink
Fix for snowflakedb#154
Browse files Browse the repository at this point in the history
Note that this might cause backward compatibility problems. It is possible that someone has noted this problem and added compensating code in the client.
Note that this is only a problem for users where the client is after GMT such as Stockholm or Helsinki
  • Loading branch information
stegus64 committed Aug 6, 2019
1 parent 1839a24 commit ecdc40e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Snowflake.Data/Core/SFDataConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,14 @@ internal static Tuple<string, string> csharpTypeValToSfTypeVal(DbType srcType, o
destType = SFDataType.DATE.ToString();
if (srcVal.GetType() != typeof(DateTime))
{
throw new SnowflakeDbException(SFError.INVALID_DATA_CONVERSION, srcVal,
throw new SnowflakeDbException(SFError.INVALID_DATA_CONVERSION, srcVal,
srcVal.GetType().ToString(), DbType.Date.ToString());
}
else
{
long millis = (long)((DateTime)srcVal).ToUniversalTime().Subtract(
UnixEpoch).TotalMilliseconds;
DateTime dt = ((DateTime)srcVal).Date;
var ts = dt.Subtract(UnixEpoch);
long millis = (long)(ts.TotalMilliseconds);
destVal = millis.ToString();
}
break;
Expand Down

0 comments on commit ecdc40e

Please sign in to comment.