Welcome to WebmasterWorld Guest from 107.21.183.163

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Please Explain with example How do I insert the date into the table

     

ifuturz

10:00 am on May 28, 2012 (gmt 0)



Please Explain with example How do I insert the date into the table in PHP ?

g1smd

10:54 am on May 28, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Let's see your code and someone can guide you where you're going wrong.

topr8

12:41 pm on May 28, 2012 (gmt 0)

WebmasterWorld Senior Member topr8 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



have you considered just using a timestamp field in the database, and let it automatically enter the date

rocknbil

4:39 pm on May 29, 2012 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Or a date type, or a datetime type.

For those, literal values must be quoted and in YYYY-MM-DD format. Date functions do not:

insert into tablename (my_date_only_field) values (curdate()); // date only

insert into tablename (my_date_and_time_field) values (now()); // date and time

insert into tablename (my_date_only_field) values ('2012-02-01'); // date only

insert into tablename (my_date_and_time_field) values ('2012-02-01 02:59:22'); // date and time

mySQL Date and Time [dev.mysql.com]
 

Featured Threads

Hot Threads This Week

Hot Threads This Month