0

I have two dates in my database

This date is from an api - 16 Nov 2017 10:54:12 +0000

This date is from my server - 16 Nov 2017 16:24:12 +0530

I want to convert this date into 16 Nov 2017 10:54:12 +0000 in my server time.

halfer
  • 19,824
  • 17
  • 99
  • 186
deepu sankar
  • 4,335
  • 3
  • 26
  • 37
  • 1
    Read about the [`DateTime`](http://php.net/manual/en/class.datetime.php) and [`DateTimeZone`](http://php.net/manual/en/class.datetimezone.php) classes. They are all you need. – axiac Nov 16 '17 at 14:05
  • `$dto = new DateTime('16 Nov 2017 16:24:12 +0530'); $dto->setTimezone(new DateTimezone('UTC')); var_dump($dto);` – Mark Baker Nov 16 '17 at 14:05
  • I would advocate closing this question if you can. The OP isn't clear, doesn't show an attempt, and the answer doesn't explain how it would help. – halfer Sep 15 '20 at 21:31

1 Answers1

-1
$value = "16 Nov 2017 10:54:12 +0000";
echo date(DATE_RFC822, strtotime($value));
halfer
  • 19,824
  • 17
  • 99
  • 186
deepu sankar
  • 4,335
  • 3
  • 26
  • 37
  • You're code does not solve OP's problem. Try expand your thought or explain your code better – pr1nc3 Nov 16 '17 at 14:53