date - MySql YYYY-MM-DDTHH:MM:SS to time -
I have a table column, one of which is in the format from the date of the varchar column:
2014-02-22T08: 08: 00
I want a SQL that prints 08:08 and which prints on 22-02-2014 but I can not seem to be working on time .
What I am trying to do is getting all the entries in the date. And at the same time print them (HH: MM) and the same.
If you are not looking for string functions but they are available here: < Ul>
A string function I think is useful for your substring operation seems you can tell according to the varchar column that you have a fixed length for it with a SUBSTRING (date from date 1 to 8) AS DateName - "2014- 02-22" SUBSTRING (date from date 5 to 10) time:
- "08:08" Use other string functions to add parts by adding them in their order.
Alternatively, you can format as required and later:
CAST (from date to date time) For more information about casting types, see the MySQL manual, which is available:
-
SQL example:
SET @DateFrom = '2014- 02-22T08: 08: 00'; SELECT DATE (CAST (date time from date of date)); - '2014-02-22' Selection time (date time from the date of the date @) (CST)); - '08: 08: 00 ''
Comments
Post a Comment