
line = "7/5/2016,123,638.5"

# split line on commas
lineFields = line.split(',')

print(lineFields)

# Individual columns from the spreadsheet
print(lineFields[0], type(lineFields[0]) )
print(lineFields[1], type(lineFields[1]) )
print(lineFields[2], type(lineFields[2]) )

# Convert ISO date --> 20161115 or 2016-1115 or 2016-11-15

dateFields = lineFields[0].split('/')
print(dateFields)

#print(len(dateFields[0]))
#print(len(dateFields[1]))

if(len(dateFields[0]) == 1):
    dateFields[0] = "0"+ dateFields[0]

if(len(dateFields[1]) == 1):
    dateFields[1] = "0"+ dateFields[1]

print(dateFields)

isoDate = dateFields[2] + dateFields[0] + dateFields[1]

print("ISO Date = ", isoDate)
