1

How do I have to write "+3 days at 12:34:56" to make strtotime() parse it properly?

1
  • In my example I would like to have the timestamp for today at 12:34:56 plus three days. Commented Sep 20, 2009 at 20:22

3 Answers 3

6
$ts = strtotime("12:34:56 +3 days");
echo date('Y-m-d H:i:s O', $ts);

prints

2009-09-23 12:34:56 +0200

(my local timezone is CEST/gmt+2)

Sign up to request clarification or add additional context in comments.

Comments

1

Oh, I got it: I just had to remove the "at": "+3 days 12:34:56" parses, yay!

Comments

0

personally I'd do something like this:

date("Y-m-d 12:34:56",time()+(60*60*24*3))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.