Changeset 10408
- Timestamp:
- 01/22/2009 09:05:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r10353 r10408 30 30 31 31 if( 'G' == $dateformatstring ) { 32 return gmmktime( 33 (int) substr( $m, 11, 2 ), (int) substr( $m, 14, 2 ), (int) substr( $m, 17, 2 ), 34 (int) substr( $m, 5, 2 ), (int) substr( $m, 8, 2 ), (int) substr( $m, 0, 4 ) 35 ); 36 } 37 38 $i = mktime( 39 (int) substr( $m, 11, 2 ), (int) substr( $m, 14, 2 ), (int) substr( $m, 17, 2 ), 40 (int) substr( $m, 5, 2 ), (int) substr( $m, 8, 2 ), (int) substr( $m, 0, 4 ) 41 ); 32 return strtotime( $m . ' +0000' ); 33 } 34 35 $i = strtotime( $m ); 42 36 43 37 if( 'U' == $dateformatstring ) 44 38 return $i; 45 39 46 if ( -1 == $i || false == $i ) 47 $i = 0; 48 49 if ( !empty( $wp_locale->month ) && !empty( $wp_locale->weekday ) && $translate ) { 50 $datemonth = $wp_locale->get_month( date( 'm', $i ) ); 51 $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth ); 52 $dateweekday = $wp_locale->get_weekday( date( 'w', $i ) ); 53 $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday ); 54 $datemeridiem = $wp_locale->get_meridiem( date( 'a', $i ) ); 55 $datemeridiem_capital = $wp_locale->get_meridiem( date( 'A', $i ) ); 56 $dateformatstring = ' ' . $dateformatstring; 57 $dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring ); 58 $dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring ); 59 $dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring ); 60 $dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring ); 61 $dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring ); 62 $dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring ); 63 64 $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 ); 65 } 66 $j = @date( $dateformatstring, $i ); 67 68 /* 69 if ( !$j ) // for debug purposes 70 echo $i." ".$mysqlstring; 71 */ 72 73 return $j; 40 return date_i18n( $dateformatstring, $i ); 74 41 } 75 42 … … 109 76 * @since 0.71 110 77 * 111 * @param string $dateformatstring Format to display the date 112 * @param int $unixtimestamp Unix timestamp 78 * @param string $dateformatstring Format to display the date. 79 * @param int $unixtimestamp Optional. Unix timestamp. 80 * @param bool $gmt Optional, default is false. Whether to convert to GMT for time. 113 81 * @return string The date, translated if locale specifies it. 114 82 */
Note: See TracChangeset
for help on using the changeset viewer.