The Tutorial illustrate an example, that help in understanding datetime. In this Tutorial ,we illustrate an example that help you in writing a date time format Query in different ways.
now ( ) :The below Query return you the current date in yyyy-mm-dd and time in hh:mm:ss.
Query for displaying current date and time:-
| mysql> select now()as DateandTime; |
Output:-
| +---------------------+ | DateandTime | +---------------------+ | 2008-12-20 12:19:07 | +---------------------+ 1 row in set (0.00 sec) |
Query for extracting date from datetime:-
The given below Query return you the current date.
| mysql> select day(now())as TodayDate; |
Output:-
| +-----------+ | TodayDate | +-----------+ | 20 | +-----------+ 1 row in set (0.00 sec) |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Mysql Date and Time
Post your Comment