Add days to a date

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
espo
Veteran Member
Posts: 98
Joined: 2013-03-01 12:55

Add days to a date

Post by espo » 2013-10-10 13:13

Hello to all,

I can add 9 days to a date?

How should I do, I have to work with the hooks and what code should I enter?


Thank you very much.

espo
Veteran Member
Posts: 98
Joined: 2013-03-01 12:55

Re: Add days to a date

Post by espo » 2013-10-15 06:59

Hello,

no one can explain how to add days to a date, and what code I have to add in hooks?

example
12/10/2013 insert and in the field to obtain (+ 8 days) 20/10/2013

Thank you very much.

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Add days to a date

Post by a.gneady » 2013-10-16 01:08

Here is some generic code that you can adapt:

Code: Select all

/* before adding to date, you need to convert it to timestamp */
$date1_timestamp = strtotime($data['date1']);

/* then add 8 days (convert to seconds first) */
$date2_timestamp = $date1_timestamp + 8 * 24 * 60 * 60;

/* finally convert to date2 */
$data['date2'] = date('Y-m-d', $date2_timestamp);
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

espo
Veteran Member
Posts: 98
Joined: 2013-03-01 12:55

Re: Add days to a date

Post by espo » 2013-10-16 09:31

Hello Ahmad,

thank you very much.
I'll try and let you know.

kavlito
Posts: 7
Joined: 2014-01-17 17:02

Re: Add days to a date

Post by kavlito » 2014-07-16 01:25

Thank you very much. This works great!

Post Reply