date date ("y, m, d) pass it to month

-4

Hello, I have in my database a date field where it is stored with $ date = date ("Ymd), and I want my table to have one where it shows the full date and another where it shows only the month as I convert it

$ date = date ("Y-m-d");

Date  Month my fields in the tables where date and month are stored in this case only date

$ so="SELECT s.Id_folio, s.date, the selection from the database with the date field Here I show the date that you send to call from the database Now what I want is to select the date field to show only the month

    
asked by Alondra Esther Santiago Marque 06.11.2018 в 18:12
source

2 answers

0

$ result = mysql_query ("SELECT datetime FROM table "); $ row = mysql_fetch_row ($ result); $ date = date_create ($ row [0]);

echo date_format ($ date, 'Y-m-d H: i: s');

output: 2012-03-24 17:45:12

echo date_format ($ date, 'd / m / Y H: i: s');

output: 03/24/2012 17:45:12

echo date_format ($ date, 'd / m / y');

output: 03/24/12

echo date_format ($ date, 'g: i A');

output: 5:45 PM

echo date_format ($ date, 'G: ia');

output: 05:45 pm

echo date_format ($ date, 'g: ia \ o \ n l jS F Y');

output: 5:45 pm on Saturday 24th March 2012

    
answered by 06.11.2018 в 18:54
0

When you get a data you can decide how an example is shown:

SELECT * FROM registro WHERE FechaHora >= CURDATE()"
    
answered by 06.11.2018 в 18:42