pymssql and date format

E

eight02645999

hi
i am using pymmsql to query a date column in MSSQL database table.
However the result shows for example
(datetime.datetime(2006, 2, 16, 17, 50, 19) which is supposed to be
2006-02-16 17:50:19.000
anyway to correct query a date column using pymssql so that it gives
the correct date format? thanks
 
S

Steve Holden

hi
i am using pymmsql to query a date column in MSSQL database table.
However the result shows for example
(datetime.datetime(2006, 2, 16, 17, 50, 19) which is supposed to be
2006-02-16 17:50:19.000
anyway to correct query a date column using pymssql so that it gives
the correct date format? thanks
It doesn't return a format, it returns a value. I presume you are saying
that you don't like the way the value prints? Use str() on it:
'2006-02-16 17:50:19'

regards
Steve
 
Joined
Oct 20, 2021
Messages
1
Reaction score
0
It doesn't return a format, it returns a value. I presume you are saying
that you don't like the way the value prints? Use str() on it:
'2006-02-16 17:50:19'

regards
Steve


Wondering is that possible to avoid this by add conversion in raw SQLs so that no need apply extra logic in Codes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top