Solved

change format of php date to insert into mysql datetime

Posted on 2013-01-23
3
726 Views
Last Modified: 2013-01-23
date is in this php format

Sat, 19 Jan 2013 22:37:46 -0500

how to use php to insert into mysql datetime column
0
Comment
Question by:rgb192
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 38812819
Try this.
echo date('Y-m-d H:i:s', strtotime('Sat, 19 Jan 2013 22:37:46 -0500'));

Open in new window


http://us1.php.net/manual/en/function.strtotime.php
http://us1.php.net/manual/en/function.date.php
0
 

Author Closing Comment

by:rgb192
ID: 38812906
date inserts into mysql now,
thank you
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 38813307
You're welcome.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now