Get current datetime using PHP

datetime, php

Solution

date_default_timezone_set('Asia/Kolkata'); 

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

Asia/calcutta has changed to Asia/Kolkata

Problem

I want to add content to a MySQL table with current date and time. When I insert the content to database it shows the correct date but the wrong time. ``` $date1 = date("Y-m-d H:i:s"); ```

Original source