What should I do to print the Date and time data normally on python

[Developmentenvironment]
python 3.6.2
qPython 1.2.2
numpy 1.13.1

1).There is the table defined by the following query and the table has thefollowing record.

[query]
Date:(NO:int$();Date:date$();time:`time$())

[record]
NO  Date        time

1   2017.09.04  08:07:00.000

2).On python, I tried to do the following procedures to the table as described aboveby using qpython,  printed the result andI happened to see the following result.

[procedures]
date = q(‘select from Date’)
print(date)
print(date.dtype)

[result]
[( 1, 6456, 29220000)]
(numpy.record, [(‘NO’, ‘<i8’), (‘Date’, ‘<i4’), (‘time’, ‘<i4’)])

3).I expected the following result, but I got the result above.
[My expectation]
[( 1, 2017.09.04, 08:07:00.000)]

4). What should I do to print theDate and time data normally, I mean not “6456, 29220000” but “2017.09.04,08:07:00.000”, on python by using qpython?

I solved this problem by referring how to convert integer into date object python(https://stackoverflow.com/questions/9750330/how-to-convert-integer-into-date-object-python).

Specifically, I added the following codes to the former one.


from datetime import datetime, timedelta

s = “20000101”

date = datetime(year=int(s[0:4]), month=int(s[4:6]), day=int(s[6:8]))

date += timedelta(days=6457)


I guess date data of kdb+ is based on the date “2000/01/01” and when we get date data from kdb+ into python by using qpython, kdb+ returns difference days between the date “2000/01/01” and the date we request. Incidentally, the number 6457 shown above is difference days between “2000/01/01” and “2017/09/05”.

So I introduced the function timedelta and could solve this problem.

Thanks.

2017?9?4??? 18?01?45? UTC+9 kdb.l...@gmail.com:

[Developmentenvironment]
python 3.6.2
qPython 1.2.2
numpy 1.13.1

1).There is the table defined by the following query and the table has thefollowing record.

[query]
Date:(NO:int$();Date:date$();time:`time$())

[record]
NO  Date        time

1   2017.09.04  08:07:00.000

2).On python, I tried to do the following procedures to the table as described aboveby using qpython,  printed the result andI happened to see the following result.

[procedures]
date = q(‘select from Date’)
print(date)
print(date.dtype)

[result]
[( 1, 6456, 29220000)]
(numpy.record, [(‘NO’, ‘<i8’), (‘Date’, ‘<i4’), (‘time’, ‘<i4’)])

3).I expected the following result, but I got the result above.
[My expectation]
[( 1, 2017.09.04, 08:07:00.000)]

4). What should I do to print theDate and time data normally, I mean not “6456, 29220000” but “2017.09.04,08:07:00.000”, on python by using qpython?