看板 PHP 關於我們 聯絡資訊
※ 引述《timyau (偉哉!33WR)》之銘言: : 我使用 PHP 來取得存在 SQL Server的日期資料 : 雖然存在SQL Server,使用 SQL Server來看資料的時候 : 日期格式是 YYYY/m/d 上午 G:i:s : 但是一旦我使用 : $sql = "SELECT myDateTime from FORM1 where myDateTime < '2006/06/30'"; : $queryResult = mssql_query($sql, $link); : $row = mssql_fetch_array($queryResult); : echo $row['myDateTime']; 1.先傳到一個變數 $tmp_time=$row['myDateTime']; 2.再使用explode切割; $array_time=explode(" ",$tmp_time) ^^^ 記得要空一格 就可以了 要顯示的話就 echo $array_time[0]."/".$array_time[1]."/".$array_time[2]; 會顯示2006/07/01 -- 孤單的越久 ‧. . .‧ 幸福 越值得期待 . ‧ ‧.▲﹀ . ‧ /\ /\ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.229.243.131 ※ 編輯: shortcake 來自: 220.229.243.131 (06/30 13:24)
dinos:echo str_replace(' ','/',$row[....]); 不是更好? @@a 06/30 13:29
dinos:嗯...選錯...我是要選 → 才對 囧"" 06/30 13:30
dinos:推回來 這樣才對 06/30 15:48