Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Parsing dates to sql

  • 28-02-2006 09: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,991 ✭✭✭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