0

I have installed Apache, PHP, MySQL separately (without WampServer). Now I would like to run following code

<?php
$d1=new DateTime('NOW');
print_r( $d1 ) ;
?>

But I am not getting any output. When I run same code on WampServer I got expected result. Do I require to make any changes in settings?

Tushar
  • 77
  • 1
  • 2

2 Answers2

2

If this is Your fresh install of PHP You need to set:

date.timezone = Europe/Warsaw

in Your php.ini config file.

The list of all timezones can be found here:

http://www.php.net/manual/en/timezones.php

Michal Przybylowicz
  • 1,558
  • 3
  • 16
  • 22
1

you have to edit your php.ini file in folder wampp/php and set the date.timezone to you timezone and try a format like

$d1 = date("d-m-Y H:i:s");

Raghu Srikanth Reddy
  • 2,703
  • 33
  • 29
  • 42
Prashanta
  • 111
  • 5