|
|
|
@ -2454,15 +2454,16 @@ function AjustaPerfil() {
|
|
|
|
|
*/ |
|
|
|
|
function strftime_( $format, $timestamp = null ){ |
|
|
|
|
|
|
|
|
|
$date_immutable = new DateTimeImmutable( ); |
|
|
|
|
|
|
|
|
|
if( $timestamp ){ |
|
|
|
|
$date_immutable = $date_immutable->setTimestamp( $timestamp ); |
|
|
|
|
} |
|
|
|
|
$date_immutable = new DateTimeImmutable( ); |
|
|
|
|
|
|
|
|
|
if( $timestamp ){ |
|
|
|
|
$date_immutable = $date_immutable->setTimestamp( $timestamp ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* tratar string */ |
|
|
|
|
|
|
|
|
|
/* tratar string */ |
|
|
|
|
$str_converted = convert_format_strftime( $format ); |
|
|
|
|
return $date_immutable->format( $str_converted ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2474,51 +2475,48 @@ function strftime_( $format, $timestamp = null ){
|
|
|
|
|
*/ |
|
|
|
|
function convert_format_strftime( $format ){ |
|
|
|
|
|
|
|
|
|
$id = 0; |
|
|
|
|
|
|
|
|
|
/* formato strftime */ |
|
|
|
|
$patterns = array( |
|
|
|
|
/* day */ |
|
|
|
|
'%a', '%A', '%d','%e', '%j','%u', '%w', |
|
|
|
|
/* Week */ |
|
|
|
|
'%U', '%V','%W', |
|
|
|
|
/* Month */ |
|
|
|
|
'%b','%B', '%h','%m' , |
|
|
|
|
/* Year */ |
|
|
|
|
'%C','%g', '%G','%y', '%Y', |
|
|
|
|
/* Time */ |
|
|
|
|
'%H', '%k', '%I', '%l', '%L', '%M', '%p', '%P', '%r', '%R', '%S', |
|
|
|
|
'%T','%X', '%z','%Z' , |
|
|
|
|
/* Time and Date Stamps */ |
|
|
|
|
'%c','%D', '%F','%s', '%x','%n', |
|
|
|
|
'%t','%%' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
/* valores similares de strftime |
|
|
|
|
* para DateTime |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
$replacements = array( |
|
|
|
|
/* day */ |
|
|
|
|
'D', 'l', 'd', 'j', 'z', 'N', 'w', |
|
|
|
|
/* Week */ |
|
|
|
|
'W', '', '', |
|
|
|
|
/* mounth */ |
|
|
|
|
'M', 'F', 'M', 'm', |
|
|
|
|
/* Year */ |
|
|
|
|
'', 'y', 'o', 'y', 'o', |
|
|
|
|
/* Time */ |
|
|
|
|
'H', 'G', 'h', 'g', 'g', 'i', 'A', 'a', '', '', 'i', |
|
|
|
|
'', '', '', '', |
|
|
|
|
/* Time and Date Stamps */ |
|
|
|
|
'','', '','', '','', |
|
|
|
|
' ','\%' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$id = 0; |
|
|
|
|
|
|
|
|
|
/* formato strftime */ |
|
|
|
|
$patterns = array( |
|
|
|
|
/* day */ |
|
|
|
|
'/%a/', '/%A/', '/%d/','/%e/', '/%j/','/%u/', '/%w/', |
|
|
|
|
/* Week */ |
|
|
|
|
'/%U/', '/%V/','/%W/', |
|
|
|
|
/* Month */ |
|
|
|
|
'/%b/','/%B/', '/%h/','/%m/', |
|
|
|
|
/* Year */ |
|
|
|
|
'/%C/','/%g/', '/%G/','/%y/', '/%Y/', |
|
|
|
|
/* Time */ |
|
|
|
|
'/%H/', '/%k/', '/%I/', '/%l/', '/%M/', '/%p/', '/%P/', '/%r/', '/%R/', '/%S/', |
|
|
|
|
'/%T/','/%X/', '/%z/','/%Z/', |
|
|
|
|
/* Time and Date Stamps */ |
|
|
|
|
'/%c/','/%D/', '/%F/','/%s/', '/%x/','/%n/', |
|
|
|
|
'/%t/','/%%/' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
echo preg_replace( $patterns, $replacements, $format ); |
|
|
|
|
/* valores similares de strftime |
|
|
|
|
* para DateTime |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
$replacements = array( |
|
|
|
|
/* day */ |
|
|
|
|
'D', 'l', 'd', 'j', 'z', 'N', 'w', |
|
|
|
|
/* Week */ |
|
|
|
|
'W', '', '', |
|
|
|
|
/* mounth */ |
|
|
|
|
'M', 'F', 'M', 'm', |
|
|
|
|
/* Year */ |
|
|
|
|
'', 'y', 'o', 'y', 'o', |
|
|
|
|
/* Time */ |
|
|
|
|
'H', 'G', 'h', ' g', 'i', 'A', 'a', '', '', 's', |
|
|
|
|
'', '', '', '', |
|
|
|
|
/* Time and Date Stamps */ |
|
|
|
|
'','', '','', '','', |
|
|
|
|
' ','%' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return preg_replace( $patterns, $replacements, $format ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|