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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    new to using MySQL

    I'm new to using MySQL and I'm having some issues creating a simple database for uploading a basic app. Can anybody help me with the format to use in the MySQL Command?

    My other question is..What is the best (most efficient) way to push the date/time into MySQL so that it saves properly, and to pull is back out of MySQL and render it on the screen in the reverse format? Thanks!
    Last edited by oracleguy; 06-29-2011 at 06:47 PM. Reason: signature rule violation

  • #2
    New Coder
    Join Date
    Jun 2011
    Posts
    29
    Thanks
    13
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by jeofjingjeff View Post
    I'm new to using MySQL and I'm having some issues creating a simple database for uploading a basic app. Can anybody help me with the format to use in the MySQL Command?

    My other question is..What is the best (most efficient) way to push the date/time into MySQL so that it saves properly, and to pull is back out of MySQL and render it on the screen in the reverse format? Thanks!
    Possibly I can help you if I know what you want to do precisely.

    And I am sure there are many of the more expert guys on this site willing to assist. I have found people on this site to extremely helpful.

    Regards Trevor
    Last edited by oracleguy; 06-29-2011 at 06:47 PM. Reason: removed signaure from quoted post

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,028
    Thanks
    75
    Thanked 4,325 Times in 4,291 Posts
    What do you mean by "MySQL Command"??

    You mean the MySQL command-line environment? Where you just get a mysql> prompt and then type in commands?

    Or do you mean some other environment?

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,028
    Thanks
    75
    Thanked 4,325 Times in 4,291 Posts
    As for dates and times: No easy answer. The only way MySQL undestands a *literal* date and time is in the form 'yyyy/mm/dd hh:mm:ss'. So '2011/6/27 15:22:00' would be valid.

    When retrieving dates, you *can* ask MySQL to convert the internal form to a string for you, but more often than not you are better off doing that in the host language (e.g., PHP or ASP or JSP) instead.

    On note: If you want to insert the date and time of *right now* into the table, then just use MySQL's built-in functions.

    Examples:
    Code:
    INSERT INTO sometable( aDateTime, aDateOnly, aTimeOnly ) VALUES( NOW(), CURDATE(), TIME(NOW()) )


  •  

    Posting Permissions

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