View Full Version : convert 2012-01-08 16:13:54 to time()
01-08-2012, 02:40 PM
How do I convert the following format to unix time ?
01-08-2012, 03:01 PM
First you need to explode the string by the space.
Then you need to explode the date by the /'s
Then you need to explode the time by the :'s
Then you need to re-arrange all those 6 variables and run them through mktime() (http://www.php.net/mktime)
You may also be able to feed it into strtotime() however that isn't as reliable (it won't take some timestrings according to the PHP versions and unlike most things, the php manual doesn't state which versions support what timestrings - EG "first day of <month>" doesn't appear to work below versions 5.3.0)
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.