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/18/2024 - 07:13:08 AM PST
		

Sponsors

Top Donators

Friends of Mine