Set date / time from user-entered month

3

I have the month entered by the user. ex:

$mes = 11;

Now I want to take this month and return the current (day / year / hour) + the month informed:

2015-11-08 14:44:00
    
asked by anonymous 08.12.2015 / 19:45

2 answers

6

It can be done like this.

$data = date("Y-".$mes_informado."-d H:i:s")
    
08.12.2015 / 19:54
0

Try:

<?php

$mes = 11;
$data = substr_replace( date( 'Y--d H:i:s' ), $mes, 5, 0 );
    
09.12.2015 / 19:32