How does one convert this date into a PHP timestamp?
-
PHP Code: <?php $signup = $user['signup']; // $user['signup'] --> 2014-01-18 04:54:21 echo date(" F jS, Y H:i:s A", strtotime("$signup")); // output --> January 18th, 2014 04:54:21 AM ?>
-
Answer:
There is no such a thing as "PHP timestamp". There are 2 types of timestamps commonly used in PHP: UNIX timestamp and MySQL timestamp. The 1st is got by $time=strtotime($str), the 2nd - by date("YmdHis",$time).
Seva Lapsha at Quora Visit the source
Other answers
You can use this function. Takes in a MySQL date time format and returns a PHP timestamp. function php_timestamp($yourMySQLDateTime){ list($date, $time) = explode(' ', $yourMySQLDateTime); list($year, $month, $day) = explode('-', $date); list($hour, $minute, $second) = explode(':', $time); $timestamp = mktime($hour, $minute, $second, $month, $day, $year); return $timestamp; }
Prithvi Raj
Related Q & A:
- How to Convert Json date string to more readable date format?Best solution by SharePoint
- How to convert full date/time to timestamp?Best solution by Stack Overflow
- How do we convert past date into future date?Best solution by Stack Overflow
- How do you convert and print from a Adobe PDF to Doc?Best solution by acrobat.adobe.com
- How do I change the date to the correct one?Best solution by answers.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.