---
title: "MySQL reading date from CSV"  
description: "MySQL reading date from CSV"  
author: "Madam Walker"  
published: 2013-07-09  
updated: 2013-07-09  
canonical: https://www.mindstick.com/forum/1270/mysql-reading-date-from-csv  
category: "mysql"  
tags: ["mysql"]  
reading_time: 1 minute  

---

# MySQL reading date from CSV

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances),\
[Right now](https://answers.mindstick.com/qa/36863/what-would-happen-if-gravity-became-5-percent-stronger-right-now) I have a [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax) in the format with columns:\
id - purchase_date - [integer](https://answers.mindstick.com/qa/113667/write-code-for-roman-to-integer) [fields](https://www.mindstick.com/forum/159126/sql-query-for-all-tables-and-fields-in-an-oracle-db).....And an [import](https://www.mindstick.com/blog/294/how-to-import-or-export-sql-server-table-data-in-ms-excel-sheet-using-c-sharp-code) of a CSV using the [script](https://www.mindstick.com/interview/477/how-can-i-execute-a-php-script-using-command-line)\
LOAD DATA LOCAL INFILE 'C:/Users/Alex/[Desktop](https://answers.mindstick.com/qa/31257/what-is-desktop-os)/work/natgas2.csv' INTO TABLE pricemodel.natural_gas FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';And everything's being imported correctly [except](https://www.mindstick.com/blog/144/union-intersection-and-except-operator-in-sql-server) for the dates which are in the format right now of:\
1/3/2011So the [question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) is what format do they have to be in for them to be read correctly into my database?\
Please help?\
Thanks in advance. \

## Replies

### Reply by AVADHESH PATEL

Hi Madam!\
Try as following line of code\
YYYY-MM-DD HH:MM:SS (24-hour time)\
If the field is of type timestamp.\
For example:\
2011-01-03 00:00:00\
I hope it resolve your problem. \


---

Original Source: https://www.mindstick.com/forum/1270/mysql-reading-date-from-csv

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
