-1

We are working with an API that has the dates provided in this format:

"DateofSignature": "\/Date(1549170000000-0500)\/",

We're not quite sure what that format is. How can we use date_format with this string? Much appreciate any pointers. Thanks.

Khom Nazid
  • 548
  • 1
  • 7
  • 20

1 Answers1

1

This is a timestamp in milisecondes, i suggest the snippet bellow to extract the date:

$text = 'Date(1549170000000-0500)';
preg_match('#\((.*?)\)#', $text, $match);

$mil = $match[1];
$seconds = $mil / 1000;
echo date("d/m/Y H:i:s", $seconds);