Results 1 to 3 of 3

Thread: From CSV file into MYSQL - how to transfer dates?

  1. #1

    From CSV file into MYSQL - how to transfer dates?

    What should the CSV date look like
    to bring it correctly into its corresponding
    Mysql field, which is formatted as a 10-digit integer field?

    Thank you.

  2. #2
    if your mysql field is an int(10), then don't even bother...
    Drop your field, and recreate it as timestamp.

    Then, you can fetch it with nearly any syntax to the db, and it shoul be able to cope with it.
    Don't trust what a select shows you, a date field is totally different of an int field, and is specially designed to make life easier when dealing with dates.
    Use it...
    mysql> select timestamp('20071215235026');
    | timestamp('20071215235026') |
    | 2007-12-15 23:50:26         | 
    1 row in set (0.00 sec)

  3. #3
    tripy - Having once read a superb book (by the Sitepoint people)
    about dates (using PHP, Mysql and javascript), I already have a whole lot
    of code resting on this 10-digit integer Mysql format.
    It really proved (for me) to be the best formatting policy
    with regard the aforementioned languages.

Similar Threads

  1. [WTS] PR1 File Mirror Site - Upload to 15 File Hosts
    By ChaoscripT in forum Sites
    Replies: 0
    Last Post: 26 September, 2010, 10:53 AM
  2. Replies: 4
    Last Post: 23 January, 2010, 10:52 AM
  3. Replies: 0
    Last Post: 23 August, 2009, 11:52 AM
  4. Replies: 13
    Last Post: 3 June, 2009, 00:37 AM
  5. Best way to transfer files between PCs?
    By Arlind in forum Tech-Talk
    Replies: 5
    Last Post: 5 May, 2009, 20:27 PM

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts