fechas en php 7
Publicado por helpme (31 intervenciones) el 01/11/2018 19:20:14
hola estoy haciendo esta fecha en php 7 pero me dice este error escribiendolo de estas 2 maneras no se por que sengun le estoy dando una booleana
http://php.net/manual/en/datetime.format.php
me estoy basando en el ejemplo del manual de php
error que me aparece en pantalla-----------
<br />
<b>Warning</b>: date_format() expects parameter 1 to be DateTimeInterface, boolean given in <b>C:\xampp\htdocs\VIATICOS\viaticos2\php\accion\excel.gastos.php</b> on line <b>24</b><br />
<br />
<b>Warning</b>: date_format() expects parameter 1 to be DateTimeInterface, boolean given in <b>C:\xampp\htdocs\VIATICOS\viaticos2\php\accion\excel.gastos.php</b> on line <b>27</b><br />
1 manera
---------------------
$fecha1 = date_format(date_create($_GET['f1']), 'Y-m-d');
$fecha2 = date_format(date_create($_GET['f2']), 'Y-m-d');
2 manera
--------------------
$crearfecha1 = date_create($_GET['f1']);
$fecha1=date_format($crearfecha1, 'Y-m-d H:i:s');
$crearfecha2 = date_create($_GET['f2']);
$fecha2=date_format($crearfecha2, 'Y-m-d H:i:s');
http://php.net/manual/en/datetime.format.php
me estoy basando en el ejemplo del manual de php
1
2
3
4
<?php
$date = date_create('2000-01-01');
echo date_format($date, 'Y-m-d H:i:s');
?>
error que me aparece en pantalla-----------
<br />
<b>Warning</b>: date_format() expects parameter 1 to be DateTimeInterface, boolean given in <b>C:\xampp\htdocs\VIATICOS\viaticos2\php\accion\excel.gastos.php</b> on line <b>24</b><br />
<br />
<b>Warning</b>: date_format() expects parameter 1 to be DateTimeInterface, boolean given in <b>C:\xampp\htdocs\VIATICOS\viaticos2\php\accion\excel.gastos.php</b> on line <b>27</b><br />
1 manera
---------------------
$fecha1 = date_format(date_create($_GET['f1']), 'Y-m-d');
$fecha2 = date_format(date_create($_GET['f2']), 'Y-m-d');
2 manera
--------------------
$crearfecha1 = date_create($_GET['f1']);
$fecha1=date_format($crearfecha1, 'Y-m-d H:i:s');
$crearfecha2 = date_create($_GET['f2']);
$fecha2=date_format($crearfecha2, 'Y-m-d H:i:s');
Valora esta pregunta


0