Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

PHP timestamp to HTML5 input type=datetime element

I want the timestamp to HTML5 input type=datetime element. How can I achieve this with PHP and HTML5?


1 Answer
karthikeya Boyini

For HTML5 input time, in PHP:

echo date("Y-m-d\TH:i:s");

The output would be:

2018-28-03T19:12:49

HTML with Timestamp would be:

<input type="datetime" value="<?php echo date("Y-m-d\TH:i:s",$timestamp); ?>"/>
Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.