0

I want to get this date's timestamp from string. I'm trying:

DateTime::createFromFormat("Y-m-d", "2015-05-18T23:45:21.604Z");

But it returns nothing. I don't know which format is this.

anderlaini
  • 1,593
  • 2
  • 24
  • 39
  • 1
    Just look up the format specifiers: http://php.net/manual/de/function.date.php – Rizier123 Jul 08 '15 at 21:39
  • you might wanna check this: http://stackoverflow.com/questions/6238992/converting-string-to-date-and-datetime The first answer splits the process in two pices. With that the debugging should be easier. – DocRattie Jul 08 '15 at 21:40
  • the problem is I don't know the format. I can use `substr()` to get only first chars from date string, but guess this is not the correct way to do this – anderlaini Jul 08 '15 at 21:46
  • You ask a new question, but you don't even end your last question: http://stackoverflow.com/q/31302585/3933332 – Rizier123 Jul 08 '15 at 21:48
  • Can you give more information on where did you get that Date string? – user9869932 Jul 08 '15 at 21:57

1 Answers1

1

try this,

$date = date_create_from_format('d/M/Y:H:i:s', '2015-05-18T23:45:21.604Z');
$date->getTimestamp();