PHP Knowledge Base
Get and Format Current Date Using date()
php:
<?php $current_date__pretty = date("D, M d, Y"); ?>
HTML:
<p>Current date: <?=$current_date__pretty?></p>
Result:
Current date: Thu, Oct 31, 2024
date()
<?php $current_date__pretty = date("D, M d, Y"); ?>
<p>Current date: <?=$current_date__pretty?></p>
Current date: Thu, Oct 31, 2024