Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    2,432
    Tokens
    141

    Latest Awards:

    Default [Help] SQL Databases

    Hey, when I add a field in a table on an SQL database, it automatically makes it yyyy-mm-dd, how can I make it dd-mm-yyyy?

    Thanks,
    Vince.
    Free Online Games And Videos:
    http://www.vincesgames.com



  2. #2
    Join Date
    Jul 2004
    Location
    Ottawa, Canada
    Posts
    1,363
    Tokens
    106
    Habbo
    Yonder

    Latest Awards:

    Default

    Where are you adding this from directly in SQL or from a script of some sort?

  3. #3
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    2,432
    Tokens
    141

    Latest Awards:

    Default

    I'm adding it directly from mySQL.
    Free Online Games And Videos:
    http://www.vincesgames.com



  4. #4
    Join Date
    Apr 2009
    Location
    Illinois, USA
    Posts
    130
    Tokens
    359

    Default

    If you're doing it via PHP, it'd be:
    PHP Code:
    <?php
    $date 
    date("d-m-Y");
    ?>
    But if you're doing it via phpMyAdmin, I don't know, and I don't know why you'd be doing it that way..


    My last reputation was from ThisNameWillDo!.

  5. #5
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    2,432
    Tokens
    141

    Latest Awards:

    Default

    Quote Originally Posted by Foskett View Post
    If you're doing it via PHP, it'd be:
    PHP Code:
    <?php
    $date 
    date("d-m-Y");
    ?>
    But if you're doing it via phpMyAdmin, I don't know, and I don't know why you'd be doing it that way..
    Thanks but is there any way to insert the values for the date aswell, I don't want it to insert the current date, I want it to insert values someone has entered in the form (their date of birth).

    Thanks,
    Vince.
    Free Online Games And Videos:
    http://www.vincesgames.com



  6. #6
    Join Date
    Sep 2005
    Posts
    888
    Tokens
    177

    Latest Awards:

    Default

    Would you just do three checks? To see if the first field is between 01-31, the second to check if the month is 01-12 and the year to be four digits.

  7. #7
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    I don't think you can? Most of the time in php you can specify the order of the date queried from the MYSQL server.
    Chippiewill.


  8. #8
    Join Date
    Jan 2007
    Location
    Wales
    Posts
    2,432
    Tokens
    141

    Latest Awards:

    Default

    Well I've got a register form and in that form they have to enter their date of birth. One field is day of birth ($dayofbirth), one is month of birth ($monthofbirth) and one is year of birth ($yearofbirth). Then $dateofbirth = $yearofbirth - $monthofbirth - $dayofbirth. That works for me, and when I try and make it $dayofbirth - $monthofbirth - $yearofbirth it won't let me because it wants it YYYY-MM-DD, I'm just wondering if there's any way to change that?

    Thanks,
    Vince.
    Free Online Games And Videos:
    http://www.vincesgames.com



  9. #9
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Quote Originally Posted by ThisNameWillDo! View Post
    Well I've got a register form and in that form they have to enter their date of birth. One field is day of birth ($dayofbirth), one is month of birth ($monthofbirth) and one is year of birth ($yearofbirth). Then $dateofbirth = $yearofbirth - $monthofbirth - $dayofbirth. That works for me, and when I try and make it $dayofbirth - $monthofbirth - $yearofbirth it won't let me because it wants it YYYY-MM-DD, I'm just wondering if there's any way to change that?

    Thanks,
    Vince.
    I don't think there's a way to change how it's stored, you can change the order that it is outputted though, there are some dedicated PHP codes for that me thinks.
    Chippiewill.


  10. #10
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    You can't change how MySQL internally stores the data but it is not limited to accepting values in that format.

    See here: http://dev.mysql.com/doc/refman/5.1/en/datetime.html for acceptable formats for DATE columns.

Page 1 of 2 12 LastLast

Posting Permissions

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