Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any difference in strtotime +day or +days?

Was googling this, but couldn't find the answer. Was wondering, if there is a difference in these two scripts?

+3 day:

echo date( 'd.m.Y H:i:s', strtotime( '+3 day' ) );

+3 days:

echo date( 'd.m.Y H:i:s', strtotime( '+3 days' ) );

The output is exactly the same.

So is that implemented to make sure people get less errors or what?
And witch one should be preferred to use?

like image 497
Peon Avatar asked Sep 20 '12 09:09

Peon


1 Answers

That is basically same thing, and for usability and pretty purposes:

strtotime( '+1 day' );
strtotime( '+3 day' );
strtotime( '+1 days' );
strtotime( '+3 days' );
strtotime( '+1 weeks' );
strtotime( '+3 week' );

You can use the one you like more, basically the one that defines de number, 1 day, 3 days

like image 72
Mihai Iorga Avatar answered Sep 23 '22 11:09

Mihai Iorga