Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Parsing dates to sql

Options
  • 28-02-2006 9:40pm
    #1
    Registered Users Posts: 1,086 ✭✭✭


    I want to insert information from a text file into my database automatically using phpmyadmin. However the dates I have are in the form of

    26-Feb-2006 12:48 PST, 21-Jan-2006 11:26 PST,


    Is there an SQL date? date time? timestamp? etc. function which understands this so I can insert them into the database with accurate dates?

    When I am calling the results from the database I want to be able to sort by date and time.

    Thanks


Comments

  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    as far as i can remeber sysdate will put the current date into your db. its shouldnt put in the time and time location bit!


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Peter B wrote:
    I want to insert information from a text file into my database automatically using phpmyadmin. However the dates I have are in the form of

    26-Feb-2006 12:48 PST, 21-Jan-2006 11:26 PST,


    Is there an SQL date? date time? timestamp? etc. function which understands this so I can insert them into the database with accurate dates?

    You don't mention what database you're using. Most databases do indeed have a conversion function (e.g. TO_DATE in Oracle) as well as date/time/datetime datatypes....but without knowing what DB system you're using....

    They generally also are able to understand strings formatted correctly....so it may be an option to find out how to reformat the string and do it that way.

    jc


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    You'd be easier just process it beforehand.


Advertisement