

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I use TIME_FORMAT() function to offload time/date values in MySQL?
TIME_FORMAT() function can be used in a similar fashion as DATE_FORMAT() function but it can only be used for offloading time values. MySQL returns a NULL value if TIME_FORMAT() function is used for offloading date values.
For example, when we pass the time format units as arguments to MySQL TIME_FORMAT() function then MySQL offloaded only the time as follows −
mysql> Select TIME_FORMAT("2017-10-22 13:03:45", "%h %i %s %p")AS 'OFFLOADED TIME'; +----------------+ | OFFLOADED TIME | +----------------+ | 01 03 45 PM | +----------------+ 1 row in set (0.00 sec)
Whereas, when we pass the date format units as arguments to MySQL TIME_FORMAT() function then MySQL returns NULL as follows −
mysql> Select TIME_FORMAT("2017-10-22 13:03:45", "%Y %M %D") AS 'OFFLOADED DATE'; +----------------+ | OFFLOADED DATE | +----------------+ | NULL | +----------------+ 1 row in set (0.00 sec)
- Related Questions & Answers
- How can we offload the time/date handling in MySQL?
- How to use together the date and time format characters in MySQL DATE_FORMAT() function?
- How to change date time format in HTML5?
- How to format date and time in android?
- Format Date and Time in Perl
- How to set default date time as system date time in MySQL?
- In MySQL, how can I insert date and time automatically while inserting NULL values to the other columns?
- How to use date time picker in Android?
- How to change date and time format in Android sqlite?
- Java Program to format date time with Join
- How can I get time and date since epoch in JavaScript?
- How can I get the current time and date in Kotlin?
- How to use TIME type in MySQL?
- How to insert current date/time in MySQL?
- How to print date and time in specific format using JSP?
Advertisements