mysql now format 1

mysql now format

SELECT DATE_FORMAT(NOW(),'%Y-%m-%d %H-%i-%s')

Here is what the above code is Doing:
1. We’re creating a variable called “sql” and assigning it a string value.
2. The string value is a SQL query that will return the current date and time.
3. We’re using the “execute” method to run the SQL query.
4. We’re using the “fetchone” method to retrieve the first row of the results.
5. We’re using the “strftime” method to format the date and time.
6. We’re printing the results.

Similar Posts