Solved

PHP Date from Twitter to MySQL format

Posted on 2013-05-30
2
735 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 109

Expert Comment

by:Ray Paseur
ID: 39209607
0
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39209610
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Creating and Managing Databases with phpMyAdmin in cPanel.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

821 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