note 80304 added to function.strtotime
| From: | tomasz dot slominski at gmail dot com | Date: | Wed, 09 Jan 2008 10:47:16 +0000 |
| Subject: | note 80304 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-134965@lists.php.net to get a copy of this message | ||
Simple date format converter with input order
<?php
function formatSQLDateTime($sDate = null, $sOrder = 'dmyhis'){
if ($sDate == null){
return date("Y-m-d H:i:s");
} else {
$aOrder = str_split($sOrder);
$aResult = preg_split('/[^\d]/',$sDate);
$nCount = count($aResult);
if ($nCount<6){
$aResult = $aResult + array_fill($nCount,6-$nCount,'00');
} // if
$aResult = array_combine($aOrder,$aResult);
return ("$aResult[y]-$aResult[m]-$aResult[d] $aResult[h]:$aResult[i]:$aResult[s]");
} // if
} // function
?>
----
Server IP: 217.174.196.197
Probable Submitter: 81.252.66.250
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/80304
Del: integrated -- https://master.php.net/note/delete/80304/integrated
Del: useless -- https://master.php.net/note/delete/80304/useless
Del: bad code -- https://master.php.net/note/delete/80304/bad+code
Del: spam -- https://master.php.net/note/delete/80304/spam
Del: non-english -- https://master.php.net/note/delete/80304/non-english
Del: in docs -- https://master.php.net/note/delete/80304/in+docs
Del: other reasons-- https://master.php.net/note/delete/80304
Reject -- https://master.php.net/note/reject/80304
Search -- https://master.php.net/manage/user-notes.php