note 118242 added to function.date

From: Date: Sun, 01 Nov 2015 13:47:51 +0000
Subject: note 118242 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-204067@lists.php.net to get a copy of this message
<?php /** * Convert a strftime format to a date format * * Unsupported strftime formats : %U, %W, %C, %g, %r, %R, %T, %X, %c, %D, %F, %x * Unsupported date formats : S, n, t, L, B, G, u, e, I, P, Z, c, r * * @param string $strftimeFormat a strftime format * @return string */ function strftimeFormatToDate($strftimeFormat) { $caracs = array( "%d" => "d", "%a" => "D", "%e" => "j", "%A" => "l", "%u" => "N", "%w" => "w", "%j" => "z", "%V" => "W", "%B" => "F", "%m" => "m", "%b" => "M", "%G" => "o", "%Y" => "Y", "%y" => "y", "%P" => "a", "%p" => "A", "%l" => "g", "%I" => "h", "%H" => "H", "%M" => "i", "%S" => "s", "%z" => "O", "%Z" => "T", "%s" => "U", ); return strtr((string)$strftimeFormat, $caracs); } $strftimeFormat = '%Y-%m-%d %H:%M:%S'; $formatDate = strftimeFormatToDate($strftimeFormat); // Y-m-d H:i:s ?> ---- Server IP: 72.52.91.14 Probable Submitter: 109.194.122.177 ---- Manual Page -- http://php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/118242 Del: integrated -- https://master.php.net/note/delete/118242/integrated Del: useless -- https://master.php.net/note/delete/118242/useless Del: bad code -- https://master.php.net/note/delete/118242/bad+code Del: spam -- https://master.php.net/note/delete/118242/spam Del: non-english -- https://master.php.net/note/delete/118242/non-english Del: in docs -- https://master.php.net/note/delete/118242/in+docs Del: other reasons-- https://master.php.net/note/delete/118242 Reject -- https://master.php.net/note/reject/118242 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204067) next »