Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I increment a date by one day in Php?

Tags:

php

I am using this this syntax to increase one day above but when i put this format it still give me wrong date like this. '01/01/1970' But I want format and date like this '25/08/2016'.

$today = '24/08/2016';
$nextday = strftime("%d/%m/%Y", strtotime("$today +1 day"));

so please help me how can i do this.advance thanx.

like image 758
Akhil patel Avatar asked Sep 06 '25 21:09

Akhil patel


1 Answers

You can use strtotime.

$your_date = strtotime("1 day", strtotime("2016-08-24"));
$new_date = date("Y-m-d", $your_date);

Hope it will help you.

like image 95
Noman Avatar answered Sep 08 '25 11:09

Noman