Solved

PHP Date from Twitter to MySQL format

Posted on 2013-05-30
2
732 Views
Last Modified: 2013-06-05
Hi experts,

I have a date in this format coming from the Twitter API:
 "Wed Aug 29 17:12:58 +0000 2012"

How do I translate this into date format used in MySQL (YYYY-MM-DD)?

I don't need the timestamp, just a date for use in MySQL.

Thank you!
0
Comment
Question by:EffinGood
  • 2
2 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
Consider your local date and time settings.
http://www.laprbass.com/RAY_temp_effingood.php

<?php // RAY_temp_effingood.php
error_reporting(E_ALL);

$twd = 'Wed Aug 29 17:12:58 +0000 2012';
$twt = strtotime($twd);
$new = date('c', $twt);
var_dump($twd, $new);

Open in new window

HTH, ~Ray
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to count occurrences of each item in an array.
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 …

744 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