note 99807 deleted from function.date by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 10:19:10 +0000 |
| Subject: | note 99807 deleted from function.date by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210755@lists.php.net to get a copy of this message | ||
Note Submitter: @PeteWilliams
----
If you want to use HTML5's <date> tag, the following code will generate the
machine-readable value for the 'datetime' attribute:
<?php
/**
* formats the date passed into format required by 'datetime' attribute of <date>
tag
* if no intDate supplied, uses current date.
* @param intDate integer optional
* @return string
**/
function getDateTimeValue( $intDate = null ) {
$strFormat = 'Y-m-d\TH:i:s.uP';
$strDate = $intDate ? date( $strFormat, $intDate ) : date( $strFormat ) ;
return $strDate;
}
echo getDateTimeValue();
?>