|
 |
|
datetime ถามหน่อยนะค่ะ คือหนูใช้date('d/m/Y h:i:s');แล้วทำไมเวลาinsertลงฐานmssql 2005 ทำไมไม่ลงอะค่ |
|
 |
|
|
 |
 |
|
มี Error มั้ยครับ
|
 |
 |
 |
 |
Date :
2009-07-02 16:51:45 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
$date_time = date("m/d/Y H:i:s"); //(เดือน/วัน/ปี เวลา) ----- เช่น "12/30/2008 00:00:00";
//ใช้กับการ Insert เข้า SQL-Server ครับ
?>
|
 |
 |
 |
 |
Date :
2009-07-02 17:07:09 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองเปลี่ยนเป็น date("Y-m-d H:i:s")
|
 |
 |
 |
 |
Date :
2009-07-03 00:38:44 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เหอๆ เจอปัญหา เดียวกันเลย
มันจะเตือน out of range ไช่ป่าว
วิธีแก้ให้บวก ปีเป็น +543 ไม่ก็ลดปี -543
ลองดูนะ
แต่ผมเจอปัญหาคือ
ไฟล์แรก ผมเขียนโค้ดเหมือนกันเปะๆ ไป insert ใน ตาราง asset1
ไฟล์ที่สอง ผมก็เขียนโค้ดแบบเดียวกัน ไป insert ใน ตาราง asset2
ดัน error out of range
บอกตรงๆ เลย datetime ใน mssql มั่วมากๆ
ผมหาทางแก้ จนไม่รุ้จะแก้ยังงัยแล้ว
โค้ดที่ใช้ได้
Code (PHP)
<?php
$datetime = date( 'j/n/Y g:i:s A', mktime( 0, 0, 0, $m, $d, $y) );
?>
โค้ดที่ error
Code (PHP)
<?php
$datetime = date( 'j/n/Y g:i:s A', time() );
?>
งงไหมละ
format เดียวกัน
อีกอันใช้ได้ แต่กลับกัน อีกอัน ใช้ไม่ได้
|
 |
 |
 |
 |
Date :
2009-07-03 17:20:54 |
By :
danya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันเกียวกับการบวก +543 นะ
ลองดูดีๆ แต่ผมยังแก้ไมได้เลย 555+
|
 |
 |
 |
 |
Date :
2009-07-03 17:22:15 |
By :
danya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากกนะค่ะแล้วจะลองดูค่ะ
|
 |
 |
 |
 |
Date :
2009-07-04 15:47:13 |
By :
LuckyStar |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|