Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7997739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:02:06+00:00 2026-06-04T15:02:06+00:00

After i imported a large csv into a table i ran into a major

  • 0

After i imported a large csv into a table i ran into a major problem in my case:
the format of the date in the csv it’s DD MM YYYY, and when i try importing that into a date/datetime it won’t work. So ok I did it with a CHAR type instead of DATE/DATETIME and it works so far. (my example: VisitTime CHAR(10) )

BUT here is the problem, with the data inside the CHAR I can’t concatenate to make a datetime column from 2 columns ( my example is: VisitTime CHAR(10) which was supposed to be DATE but isn’t working since it’s wrong format DD MM YYYY and HourTime which is TIME.
Bottom line: i need a column in another table VisitTimeandHour DATETIME which results from a concatenation of VisitTIME CHAR(10) and a HourTime TIME.
A solution was maybe making all the columns that i talked about VARCHAR and it was i think no problem, but i wanna stick with date and datetime 🙂
Waiting for solutions, thanks in advance.

Correct me if i’m wrong but if i try to import into a variable then converting it would be ok?, and by the way an example of date that needs to be converted from the csv is: 22/04/2005 ) the code:

SET @var1 = NULL;
load data infile ‘xxxx/xxx/xxx/xxx/xxx’
into table vizite_intermtest
character set utf8
fields terminated by ‘,’
lines terminated by ‘\n’
ignore 1 lines
(@var1,OraIntrare,NumePacient,PrenumePacient,NumeMedic,PrenumeMedic,Cabinet)
SET VisitTime = STR_TO_DATE(@var1, ‘%d/%m/%y’);

If i try this it says: truncated inccorect value 22/04/2005 (the VisitTime column that i wanna import in it’s a CHAR type)

LE: It works to import into a variable and to convert it but altough i put the / / / between them it still gives me the time format with – – – … any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:02:07+00:00Added an answer on June 4, 2026 at 3:02 pm

    You should stick with the DATE / DATETIME fields, but tell MySQL how to interpret the incoming data. I’m not certain how you imported the data, but the function to interpret a string as a date is STR_TO_DATE:

    STR_TO_DATE( '01 02 2003', '%d %m %Y' )
    

    For more info, see the following:
    http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to perform date manipulation of an imported csv file with the first
I have imported multiple projects in eclipse through maven. After importing the projects in
About 2 months ago, I imported EnWikipedia data(http://dumps.wikimedia.org/enwiki/20120211/) into mysql. After finished importing EnWikipedia
How do I re-enable this? It happened after I imported a settings theme, which
I'm still learning python and after playing around with pygame I noticed I'm re-importing
I have some large csv file, with about 200 header names (the first one
I'm trying to import a large subversion repository into git using git-svn (so that
In my script, I've imported urrlib2 and the script was working fine. After reboot,
I want to establish a standard script file that is imported into python at
I'm trying to import a csv into a recordset. I've been using code kindly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.