diff --git a/mapserver/cgi-bin/layer_times_postgres.py b/mapserver/cgi-bin/layer_times_postgres.py
index 0b61b7339be77c03b3313e39a20eac09f36c631f..0eb6d30ea3dbb52c2d4b256006f5918741666c8c 100755
--- a/mapserver/cgi-bin/layer_times_postgres.py
+++ b/mapserver/cgi-bin/layer_times_postgres.py
@@ -33,7 +33,7 @@ try:
     conn = psycopg2.connect(connect_str)
     with conn:
         with conn.cursor() as cur:
-            cur.execute(sql.SQL("SELECT time FROM {}").format(sql.Identifier(table_name)))
+            cur.execute(sql.SQL("SELECT start_time FROM {}").format(sql.Identifier(table_name)))
             times = cur.fetchall()
 except psycopg2.errors.DataBaseError:
     print("""Status: 500 Database Error
@@ -44,6 +44,8 @@ Error requesting time information from database.
 """)
     sys.exit(1)
 
+# postgres returned a list of tuples
+times = [time_tuple[0] for time_tuple in times]
 
 print("Content-Type: application/json")
 print("Access-Control-Allow-Origin: *")