mssql date format

MRAB python at mrabarnett.plus.com
Sun Sep 11 21:15:11 EDT 2016


On 2016-09-12 01:37, sum abiut wrote:
> Hi,
> I am pulling data from an mssql server database and got a date in this
> format: 733010
> please advise what of date is this and how to i convert it to a readable
> date?
>
> i use pyssql to connect to the database and pull data fro the database.
>
Does the date "30 November 2007" look reasonable for that data?

If it does, it's a """proleptic Gregorian ordinal, where January 1 of 
year 1 has ordinal 1""" (from the docs):

>>> import datetime
>>> datetime.datetime.fromordinal(733010)
datetime.datetime(2007, 11, 30, 0, 0)




More information about the Python-list mailing list