Hi I have a date stored in the database, when I go to see the form, I want him to be added a day, so as;
the date in the database
01/01/2014
becomes in the form
02/01/2014
How can I do ???
Hi I have a date stored in the database, when I go to see the form, I want him to be added a day, so as;
the date in the database
01/01/2014
becomes in the form
02/01/2014
How can I do ???
If your fields are like {theDate} and {next_day} then:
$given_date = date_create_from_format('d/m/Y',{theDate});
{next_day} = date('d/m/Y', strtotime("$givenDate +1 Days"));
If you are doing this on a grid, where you can edit your sql, an easier alternative is to add the new fake field to your SQL:
SELECT[INDENT]...
DATE_ADD(`theDate`, INTERVAL 1 DAY) AS next_day,
...
[/INDENT]
[B]
PHP Note:[/B] Be aware of dates in the m/d/y or d-m-y formats; if the separator is a slash (/), then the American m/d/y is assumed. If the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed. To avoid potential errors, you should YYYY-MM-DD dates or date_create_from_format() when possible.
Dave