How to format date in PHP from a string of concatenated numbers?
I am new to PHP and I am trying to learn more of php date and time but I
seem to get stuck with this.
I have this date format:
ddMMyyHHmmss
And an example is 120813125055 but I am trying to manipulate the string
such that it will give me the format of:
yyyy-MM-dd HH:mm:ss (in the example above, 2013-08-12 12:50:55)
I tried to do something like:
date('Y-m-d H:i:s', strtotime('120813125055'));
But it always gives me a result of 1969-12-31 18:00:00.
I assume that I need to do some string manipulation in PHP for this but I
was wondering if there is an easier and more efficient way to do it?
No comments:
Post a Comment