0

I've got a var $date_ordered that gives me the following string: "2013-07-02 07:48:06" I want php to recognize this as a date, put it in the following format: "2013-07-02T07:48:06+0100" And add 48 hours to it.

How would I go about doing that?

Kind regards

user25312
  • 187
  • 2
  • 16

1 Answers1

1

Convert your date to time, add 48 hours then convert to ISO 8601 (as it seems that's what you want):

$a = '2013-07-02 07:48:06';
$time = strtotime($a);
$time += 48 * 60 * 60;
echo date(DATE_ISO8601, $time) . PHP_EOL;
Guillaume
  • 10,463
  • 1
  • 33
  • 47