just copy the below code and place anywhere you want the date to appear. Shows date in dd-mm-yyyy format.
<?php echo date('d-m-Y'); ?> //Prints date in DD-MM-YYYY format
<?php echo date('Y-m-d'); ?> //Prints date in YYYY-MM-DD format which is used in Mysql database
if you want this as a default value in any input box when working with forms such as a date input box use this
<input type="date" name="" value="<?php echo date('d-m-Y'); ?>">
No comments:
Post a Comment