Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

change format of php date to insert into mysql datetime

Posted on 2013-01-23
3
735 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 83

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 83

Expert Comment

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

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
INDEX does not make a difference, why? 10 60
Why will this INSERT statement not insert the date? 2 20
Help with PHP 13 27
How do I show metrics with PHP or Javascript 6 32
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

856 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