Picnic Website Code Tutorials

PHP Display Current Date and Time

4/20/2013

PHP Current Date and TimeHow to display the current date and time using PHP? This is how. FYI - you cannot echo the specific users timezone using PHP. For that you need JS. But you can set your prefered timezone using the snippet below and then just say "Pacific Standard Time" as I did.

PHP Date/Time Snippet

<?php
    date_default_timezone_set('America/Los_Angeles');
    echo date("m/d/Y - H:i:s A", time());
?> PST
		

Will Display This...

12/09/2016 - 07:27:38 AM PST
		

Need help adding this or other code to your website? Post it here in the forum! Forum

Sponsors

Top Donators

Friends of Mine