Converting SQL datetime2 field to UNIX epoch

I'm ingesting a SQL datetime2 field from a SQL Server 2012 instance via JDBC and I'm looking to convert the field to UNIX epoch format. Ruby is not playing nicely with the fact that the original field being ingested from SQL is of type datetime2. I'm able to convert strings of the same format to Unix epoch, so the issue lies with the fact that the field is of type datetime2. Has anyone ever dealt with this? Thanks for the help.

Can you provide an example of the format from SQL?

Where you able to resolve this issue? I have the same problem and i'm trying to import from sql and one of the field is of type datetime2 and while importing using logstash i get the below error

Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::ComMicrosoftSqlserverJdbc::SQLServerException: Operand type clash: datetime2 is incompatible with int>, :level=>:warn}