0

I have several dates being outputted into variables. They are formatted as follows:

/Date(1341788400000+0100)/

How would I go about formatting them using PHP into:

DD/MM/YYYY HH:MM

Thanks!

Gruff Vaughan
  • 131
  • 1
  • 9

3 Answers3

4

I ended up using the following, as the initial format was in milliseconds:

$date = 1341788400000+0100;
$date = ( $date / 1000 );
$date = date("d/m/Y H:m", $date);
Gruff Vaughan
  • 131
  • 1
  • 9
0
$date = 1341788400000+0100;
echo date("Y/m/d H:m",$date);

Unless the +0100 is the actual time of the day (01:00) ?

NewInTheBusiness
  • 1,465
  • 1
  • 9
  • 14
0

First, you parse it, e.g. using strtok() http://php.net/manual/en/function.strtok.php

Then parse it as a number.

$seconds = intval($a)

Then format it using

date("Y/m/d H:m", $seconds)`.
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277