HS Banner
Back
HTML Datetime Input Box

Author: Admin 05/15/2022
Language: PHP
Views: 395
Tags: input datetime-local php html


Description:

Here's some code to set the default datetime for an input box with its type set to datetime-local using HTML and PHP.

Article:

Set the datetime format in PHP.

<?php
$datetime = date('Y-m-d\TH:i')
?>

Form field input box code.

<input type="datetime-local" value="<?php echo $datetime; ?>"/>

Or use the PHP short echo tag.

<input type="datetime-local" value="<?=$datetime; ?>"/>



Back
Comments
Add Comment
There are no comments yet.