php - MySQL Date stored as 12h without AM/PM -


i realized, 6 months after system went live, insert query had h instead of h, bunch of entry dates stored 12 hour dates without am/pm indicator. there relatively simple method of fixing problem? database powered mysql 5.1.56-log.

i'm idiot.

i managed write python script achieved needed, if else ever runs problem, work fix it. (hooray!)

import datetime #example data entries = [     ('2014-10-10 04:07:48', 1, 1136, 'jh'),     ('2015-04-13 08:31:33', 0, 3066, 'mez'),     ('2015-04-13 09:38:06', 0, 3067, 'vl'),     ('2015-04-13 10:34:54', 1, 3068, 'j.a'),     ('2015-04-14 02:43:08', 1, 3069, 'acm'),     ('2015-04-14 03:35:49', 0, 3070, 'acm'),     ('2015-04-14 08:30:39', 0, 3071, 'ic'),     ('2015-04-14 09:35:07', 1, 3072, 'dk'),     ('2015-04-14 10:38:36', 0, 3073, 'zg'),     ('2015-04-14 11:36:09', 0, 3074, 'vl'),     ('2015-04-14 12:46:23', 1, 3075, 'eb'),     ('2015-04-14 01:44:18', 0, 3076, 'eb')]  last_date = datetime.datetime.now() last_time = last_date.time() after_noon = false twelve_hours = datetime.timedelta(hours=12) entry in entries:     current_date = datetime.datetime.strptime(entry[0], '%y-%m-%d %i:%m:%s')     if current_date.date() != last_date:         last_date = current_date.date()         after_noon = false         last_time = current_date.time()     else:         if after_noon:             current_date = current_date + twelve_hours         else:             if current_date.time() < last_time:                 after_noon = true                 current_date = current_date + twelve_hours     print "('" + str(current_date) + "', " + str(entry[1]) + ", " + str(entry[2]) + ", " + "'" + entry[3] + "')," 

this specific columns in mysql export, can easy adapted other schemas.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -