tags:

views:

36

answers:

2

I am trying to convert a date/time string in this format

YYYY/MM/DD/HH:MM:SS

to a format that is recognized in PHP

+1  A: 

if it's exactly that, just do strtotime(substr($mydate,0,10)." ".substr($mydate,-8)) which converts it to "YYYY/MM/DD HH:MM:SS", which PHP does parse correctly.

It's the middle slash which is probably the issue, in other words.

razzed
A: 

PHP can parse that string: strptime($time, '%Y/%m/%d/%H:%M:%S')

You
This returns an array however.
Josh Stuart
But it does parse the date.
You
That's true, you would need to recombine it for it to be useful as a timestamp, which is usually the most efficient way of working with dates. Nevertheless it does parse.
Josh Stuart
and it does not seem to work on XAMPP stack
roger rover
That's because I mixed up the date order. Fixed.
You