4

I'm trying to understand what $now parameter is doing in php function

strtotime(string $time [, int $now = time() ])

Everybody seems to simply ignore the $now parameter and the documentation for it is not very clear.

How does that parameter really affect the returned value?

0

1 Answer 1

4

It is an optional parameter for a unix timestamp. If it is used, the current clock used in the function will be the value of the $now otherwise, the current timestamp is used.

For example, if you pop in "yesterday" if you don't put in the optional param, it assumes you mean yesterday really. If you put in the timetamp for 1 week ago, it gives you the answer for yesterday i week ago.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.