php - Select a substring (date) and convert it -


I have a column with date format (format) YYYY-MM- DDTHH: MM: SS

I use this SQL to take the time for a specific date:

  SELECT SUBSTRING (date 5 to 5) From) Date From Date (SUBSTRING) From Date: From 1 To 10 = "'. $ Date." "  

It gives me:

  HH: MM date $   

(from datepicker format) DD.MM.YYYY

I am creating a website so that the user should see the time associated with a date

before I check it Can I convert the wire from the database that it is equivalent to . Date date ?

or is it from datepicker to YYYY.MM.DD instead ?

How to get rid of substrings Instead of stuff and use it in Ray, choose

  as the time (date format) from `to` calendar WHERE DATE (datefirm) = STR_TO_DATE ($ date, '% d % M.% Y ')   

This will work because your DateFrom field is stored in standard string format of DATETIME object.

to Is in bettix because it is a reserved word.

You really want to consider changing datatype's date type DATETIME. Hia, and then the column should indexing. Then you have your WHERE clause on

  WHERE DateFrom> = STR_TO_DATE ($ date, '% d.% M %% Y') and by date & lt; STR_TO_DATE ($ date, '% d.% M %% Y') + INTERVAL 1 DAY   

And you'll get great performance benefits.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -