簡體   English   中英

格式化Datetime2對象

[英]Format Datetime2 object

我有一個datetime2看起來像這樣:

2012-10-06 22:00:00.0000000 

(使用PHP用於Microsoft Azure),但我不知道如何將其格式化為以下格式:

October 06, 2012 at 22:00

有任何想法嗎?

使用strtotime()

echo date('F d, Y \a\t H:i', strtotime('2012-10-06 22:00:00.0000000'));
// October 06, 2012 at 22:00

請參考此Date()strtotime()函數以實現此目的。

$currentdate="2012-10-06 22:00:00.0000000";
$timestamp=strtotime($currentdate);
$newdate=date("F d Y g:i",$timestamp);
echo $newdate;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM