Python Forum
How to format a datetime MySQL database field to local using strftime()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to format a datetime MySQL database field to local using strftime()
#7
# dbhost is optional, default is localhost
plugin = bottle_pymysql.Plugin( dbuser='nikos', dbpass='*******', dbname='counters', charset = 'utf8' )
app.install(plugin)
 
.....
pymydb.execute( '''SELECT host, ref, location, useros, browser, visits, hits, downloads, authuser FROM guests
					WHERE pagesID = (SELECT ID FROM pages WHERE url = %s) ORDER BY visits DESC''', page )
	data = pymydb.fetchall()
        for visit in visits:
              visit = visit.strftime('%A %e %b,  %I:%M %p')
'visit' is being returned from database containing a MySQL datatime field that i want t
o change to another format whcih is ('%A %e %b, %I:%M %p') thats why i'm using that function. If not convert or comment out then results are not appearing normally.
Reply


Messages In This Thread
How to make bottle-pymysql work - by nikos - Feb-24-2019, 04:41 PM
RE: How to make bottle-pymysql work - by buran - Feb-24-2019, 04:42 PM
RE: How to make bottle-pymysql work - by nikos - Feb-24-2019, 04:43 PM
RE: How to make bottle-pymysql work - by buran - Feb-24-2019, 04:48 PM
RE: How to make bottle-pymysql work - by nikos - Feb-24-2019, 04:56 PM
RE: How to make bottle-pymysql work - by nikos - Feb-24-2019, 06:23 PM
How to format a datetime MySQL database field to local using strftime() - by nikos - Feb-24-2019, 06:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  User Input to mySQL database newbie1 3 4,199 Aug-26-2020, 10:42 AM
Last Post: newbie1
  Flask export/upload database table in cvs/xlsx format steve87bg 4 6,864 Jun-19-2020, 01:46 PM
Last Post: steve87bg
  MySQL Database Flask maurosmartins 0 1,823 Oct-03-2019, 10:56 AM
Last Post: maurosmartins
  mysql database error brecht83 1 5,034 Dec-14-2018, 01:25 PM
Last Post: jeanMichelBain

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020