Okey, i have many hours now struggling to convert a mysql datetime
field that i retreive to a string of this format '%d %b, %H:%M'

I google a lot but couldnt found out how to format it being a string

Here si the code so far:

        try:
                cursor.execute( ''' SELECT host, hits, date FROM visitors WHERE 
page
= '%s' ORDER BY date DESC ''' % (page) )
        except MySQLdb.Error:
                print( "Error %d: %s" % (e.args[0], e.args[1]) )
        else:
                #display results
                print ( '''<center><br><h3> ( Επισκέπτης ) ----- ( Επισκέψεις )
----- ( Ημερομηνία ) </h3><br>''' )
                print ( '''<table border = "5" cellpadding = "5">''' )

                results = cursor.fetchall()

                for row in results:
                        print ( ''' <tr> ''' )

                        for entry in row:
                                entry = datetime.datetime.strftime( entry, '%d 
%b, %H:%M' ) #!!!
this is wrong!
                                print ( ''' <td> %s </td> ''' % entry )

                sys.exit(0)

Apart from that i don't know how iam supposed to print it, because the
date string is the 3rd string in every row of the dataset.

Please help me out!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to