homepage Welcome to WebmasterWorld Guest from 54.211.95.201
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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




msg:4458564
 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




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

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

topr8




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

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

rocknbil




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

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]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved