Skip to Content
Menu
This question has been flagged
4 Replies
15105 Views

17-12-2015 7:05' does not seem to be a valid date for field 'Order Date' 

at row 2 

Use the format '2012-12-31'     -- >  while i was use field.Date

and

'17-12-2015 7:05' does not seem to be a valid datetime for field 'Order Date' 

at row 2

Use the format '2012-12-31 23:59:59'  -- >  while i was use field.Datetime


how i can upload dd/mm/yyyy / H/M format   from CSV file
my actual date like that 

17-12-2015 8:38

Avatar
Discard
Best Answer

CSV import expects dates in a specific format - and it tells you this - they need to be in the format "2012-12-31 23:59:59".

Unless you can change the format of the date fields in your files, you can't import them via CSV.


Krupesh is advising either to run a script, or to use Excel/Open Office to change the format of the field into the correct format.

Avatar
Discard
Best Answer

write one script in python and create new csv file for the date format:

suppose you have customer csv open it using below code and format date as per requirement I had split the date with . (dot) you have to format the code as per your requirement.

from new csv file copy whole column to the original csv file you get the formatted date as per requirement.

import csv

csv_rd = csv.reader(open("customer"+".csv"), delimiter=';')

count = 0

for rec in csv_rd:

fields = rec

break

all_datas = []

for rec in csv_rd:

all_datas.append(rec)

a = []

for rec in all_datas:

print rec[7]

print rec[7].split('.')

s = rec[7].split('.')[2] + '-' + rec[7].split('.')[1] + '-' + rec[7].split('.')[0]

print s

a.append(s)

with open('eggs.csv', 'wb') as csvfile:

spamwriter = csv.writer(

csvfile, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL)

for val in a:

spamwriter.writerow([val])

Avatar
Discard
Author

@krupesh is this every time task or a single time task ? bcoz i want daily upload 5-10 file with more the 2000 record in every file ... every time i(we) can't upload multiple time file like first change the date and then after upload in main place can you know about any date field which can directly convert date in dd-mm-yyyy h-m format without upload another place upload file

Please try do it from property of the column you can change property of the column may be this is help full to you.

Related Posts Replies Views Activity
2
Jan 24
946
2
Jun 22
2625
1
Oct 21
2188
3
Jun 20
2088
1
Nov 18
7460