I am trying to get the local time using php. I wrote two different versions, but they both give the wrong time
date_default_timezone_set(\'UTC\');
$now = new Dat
You need to use javascript because you want the value of time from the client. PHP is a server-side language that evaluates on the server and sends results to the client. So if you try to pull a date/time using a PHP function, it's going to pull the date from the server, which is not always in the client's timezone.
You can do this in a javascript function and then reference the value in the display.
var thisDateTime = new Date();