我编写了一个查询来从SQL Server中的表中检索一行。我在这里使用pyodbc和python 3.7。
我得到以下信息:
(18, 3, 1, 'test', 'test', None, Decimal('0.0000'), Decimal('0.0000'), 0, 0, b'x00x00x00x00x0fxe7xaco')
The last value b'x00x00x00x00x0fxe7xaco' is the timestamp of the row which looks like follows in the database "0x000000000FE7AC6F".
我希望能够按原样检索时间戳,或者能够在调用另一个使用该值的查询之前将b'x00x00x00x00x0fxe7xaco'
转换为正确的时间戳值。
由于您使用的是python3,因此转换相对容易。
s=b'x00x00x00x00x0fxe7xaco'
'0x'+s.hex().upper()
有输出
'0x000000000FE7AC6F'