All pastes #814137 Raw Edit

Stuff

public text v1 · immutable
#814137 ·published 2007-12-13 00:43 UTC
rendered paste body
import csv, sys, re
from time import *

dateformat = re.compile("(\d*)/(\d*)/(\d*) (\d*):(\d*):(\d*.\d*)")

def tounix(s):
    m = dateformat.match(s)
    seconds = float(m.group(6))
    return mktime((int(m.group(3)), int(m.group(1)), int(m.group(2)),
        int(m.group(4)), int(m.group(5)), 0, 0, 0, -1)) + seconds

reader = csv.reader(sys.stdin)  # Or use filenames from sys.argv
writer = csv.writer(sys.stdout)


for row in reader:
    row[0] = tounix(row[0])
    writer.writerow(row)