Thanks for the response, i pulling data from an mssql database and i need to convert the date column. how to i covert and pass it to my template. i am using Django
this is what i did conn=pymssql.connect(server,username,password,database) #cus=conn.cursor() cus=conn.cursor(as_dict=True) cus.execute("SELECT account_code,currency_code,balance_date,debit,credit,net_change,home_net_change FROM glbal where account_code= '50101001CORP' ") return render_to_response('revenue_budget.html',locals()) how to i convert the balance_date with the code below: import datetime >>> datetime.datetime.fromordinal(733010) >>> >> datetime.datetime(2007, 11, 30, 0, 0) On Mon, Sep 12, 2016 at 12:15 PM, MRAB <pyt...@mrabarnett.plus.com> wrote: > 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) > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list