-1

I never thought this will be such a pain. What is the best way to convert back this timestamp to a standard PHP timestamp that strtotime() accepts? :

September 29, 2017, 7:16 UTC

The format is:

date("F j, Y, G:i T")

3
  • What happens when use use strtotime? Commented Oct 18, 2017 at 16:50
  • 2
    It is converting fine, $timestamp = strtotime('September 29, 2017, 7:16 UTC'); echo $timestamp; echo date("F j, Y, G:i T",$timestamp); what is the problem? Commented Oct 18, 2017 at 16:51
  • Thanks for the quick answer and confirmation! Indeed, there was another problem, maybe in the string i provided to strtotime. I don't know, probably the problem is in between the screen and the chair. Commented Oct 18, 2017 at 17:21

1 Answer 1

1

Build a DateTime object first, then format it to a standard format, this will pass into strtotime.

$date = "September 29, 2017, 7:16 UTC";
$day = new DateTime($date);
$utc = strtotime($day->format("Y-m-d g:i A"));
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.