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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Parsing dates to sql

  • 28-02-2006 8:40pm
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    You'd be easier just process it beforehand.


Advertisement