Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
16441 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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])

Ảnh đại diện
Huỷ bỏ
Tác giả

@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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 1 24
2765
2
thg 6 22
4716
1
thg 10 21
3474
3
thg 6 20
4073
1
thg 11 18
9536