এটি আপনার ডিবি টেবিলের জন্য আপনি কী ডেটাটাইপ সেট করেছেন তার উপর নির্ভর করে।
তারিখ সময় (ডেটাটাইপ)
MYSQL
INSERT INTO t1 (dateposted) VALUES ( NOW() )
// This will insert date and time into the col. Do not use quote around the val
পিএইচপি
$dt = date('Y-m-d h:i:s');
INSERT INTO t1 (dateposted) VALUES ( '$dt' )
// This will insert date into the col using php var. Wrap with quote.
তারিখ (ডেটাটাইপ)
MYSQL
INSERT INTO t1 (dateposted) VALUES ( NOW() )
// Yes, you use the same NOW() without the quotes.
// Because your datatype is set to DATE it will insert only the date
পিএইচপি
$dt = date('Y-m-d');
INSERT INTO t1 (dateposted) VALUES ( '$dt' )
// This will insert date into the col using php var.
সময় (ডেটাটাইপ)
MYSQL
INSERT INTO t1 (dateposted) VALUES ( NOW() )
// Yes, you use the same NOW() as well.
// Because your datatype is set to TIME it will insert only the time
পিএইচপি
$dt = date('h:i:s');
INSERT INTO t1 (dateposted) VALUES ( '$dt' )
// This will insert time.