Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
01-08-2012, 01:40 PM #1
- Join Date
- Oct 2009
- Thanked 3 Times in 3 Posts
convert 2012-01-08 16:13:54 to time()
How do I convert the following format to unix time ?
01-08-2012, 02:01 PM #2
- Join Date
- Feb 2011
- Your Monitor
- Thanked 525 Times in 512 Posts
- Blog Entries
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()
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)
See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/
Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!