Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts

    How to convert uk date to mysql date format

    Hello,

    anyone knows how to convert uk date to mysql date format? I have 3 textboxes having the values of dates.

    the format are the following:

    textbox1-29/08/2007
    textbox2-14/08/2007
    textbox3-20/08/2007

    upon entering it into the database the following dates should be converted already to the mysql date format like 2007-08-29


    tnx...
    Last edited by che_anj; 08-30-2007 at 11:38 AM. Reason: a

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,859
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Are you looking for something like str_to_date
    Last edited by abduraooft; 08-30-2007 at 11:58 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts
    the date is not yet entered in the database.. It must be converted first to mysql date format before saving it..

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,859
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Code:
    insert into table_name(field) values (STR_TO_DATE('08/25/2007', '%m/%d/%Y'))
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts
    can u give me an example?

    i try but it displays 1970-01-01

    $start=$_POST['startdate'];
    echo date('Y-m-d',$start);

  • #6
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    The example is above. Nowhere in the example shown is the date function


  •  

    Posting Permissions

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