473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

pymssql and date format

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

Feb 16 '06 #1
1 5406
ei***********@yahoo.com wrote:
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:
str(datetime.datetime(2006, 2, 16, 17, 50, 19))

'2006-02-16 17:50:19'

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Feb 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Khawaja Shahzad Sadiq Butt | last post by:
Hi, I am trying to connect to sql server 2000 on win xp. I am using a python extension called. pymssql but it is giving me this errror: Traceback (most recent call last): File...
0
by: saqib | last post by:
I have a query that is running on a mssql DB that takes about 15 minutes when run "directly"; IE: thru MS SQL Query Analyzer. I know, it sucks. I'm trying to fix it. But in the meantime, I have...
1
by: morris carre | last post by:
I have a strange problem : some code that fetches queries from an mssql database works fine under Idle but the very same code run from a shell window obtains its strings garbled as if the encoding...
1
by: m.biddiscombe | last post by:
Hi, I'm trying to use pymssql to execute a stored procedure. Currently, I have an Excel spreadsheet that uses VBA in this manner: Private Function CreateNewParrot(connDb As ADODB.Connection)...
3
by: rc | last post by:
How to insert NULL values in to int field using params. I'm trying to use pymssql.execute, passing the operation and list of params. One of the values in the params is a NULL value going to int...
1
by: James Su | last post by:
I tried to use pymssql to access MSSQL 2000, with a table, I store Chinese Character in NVarchar field, Chinese Character display normally when I query them by MS SQL Query Analyzer under Windows...
0
by: Fredrik Lundh | last post by:
Samuel Morhaim wrote: reading the documentation might help: http://pymssql.sourceforge.net/troubleshooting.html#dbid </F>
7
by: ChaosKCW | last post by:
Hi I am trying to use pymssql, and have an issue where by the execute (not the fetch) is appearing to load all records into memory. if I execute con = pymssql.connect(...) cur =...
0
by: Aspersieman | last post by:
On Tue, 21 Oct 2008 20:44:24 +0200, Mike Hansen <projecktzero@yahoo.com> wrote: Hi there I hope you don't mind - I made this a new thread on the list, so others can maybe help out. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.