Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How change date format using MySql

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 602
    Comment on it

    Hello Reader's if you are using unix timestamp for storing date the time. Then you have to convert them into date format. But now MySql has come with a new syntax of 'format', Because of this it will make the conversion as you want and will save your work.

    Lets see how to use this in mysql query

    SELECT city, country, FORMAT(Now(),'DD/MM/YYYY') AS countryDate
    FROM worldClock;
    

    So now using this new mysql syntax you don't have to make the date conversion, in the code above it's auto fetching the records and also making their date conversion at same time.

    And this code you can also get output in different formats like:-

    DD-MM-YY
    DD MM YYYY
    YYYY-MM-DD
    YYYY/MM/DD
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: