mysql_to_rfc3339

函式
mysql_to_rfc3339 ( $date_string )
引數
  • (string) $date_string Date string to parse and format.
    Required:
返回值
  • (string) Date formatted for ISO8601 without time zone.
定義位置
引入
4.4.0
棄用
-

mysql_to_rfc3339:該函式將MySQL日期轉換為RFC3339日期格式。它需要一個引數,即MySQL日期字串,並返回一個格式化的日期字串。

為ISO8601(Y-m-d H:i:s)解析和格式化MySQL日期時間(Y-m-dTH:i:s)。

明確剝離時區,因為日期時間的儲存不包含任何時區資訊。包括任何關於偏移的資訊可能會產生誤導。

儘管有歷史性的函式名稱,但輸出並不符合RFC3339格式,它必須包含時區。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function mysql_to_rfc3339( $date_string ) {
return mysql2date( 'Y-m-dTH:i:s', $date_string, false );
}
function mysql_to_rfc3339( $date_string ) { return mysql2date( 'Y-m-dTH:i:s', $date_string, false ); }
function mysql_to_rfc3339( $date_string ) {
	return mysql2date( 'Y-m-dTH:i:s', $date_string, false );
}

常見問題

FAQs
檢視更多 >