note 99807 added to function.date
| From: | at PeteWilliams | Date: | Wed, 08 Sep 2010 11:29:09 +0000 |
| Subject: | note 99807 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172374@lists.php.net to get a copy of this message | ||
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();
?>
----
Server IP: 92.48.74.199
Probable Submitter: 81.100.63.24
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/99807
Del: integrated -- https://master.php.net/note/delete/99807/integrated
Del: useless -- https://master.php.net/note/delete/99807/useless
Del: bad code -- https://master.php.net/note/delete/99807/bad+code
Del: spam -- https://master.php.net/note/delete/99807/spam
Del: non-english -- https://master.php.net/note/delete/99807/non-english
Del: in docs -- https://master.php.net/note/delete/99807/in+docs
Del: other reasons-- https://master.php.net/note/delete/99807
Reject -- https://master.php.net/note/reject/99807
Search -- https://master.php.net/manage/user-notes.php