This topic is locked
[SOLVED]

 auto date calculation

12/1/2009 6:58:53 AM
PHPRunner General questions
T
tedwilder author

Hello ,

I use a table for coupons. those coupons are time limited. In my example I want them to last 6 months. Is there any code you know, or method to automaticly fill the expiration date ? : I mean I have 2 field : createdate, and expiredate. I'd like the expire date to be filled with a + 6 months date because counting on fingers for each entry is not cool ! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=13245&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

thank you.

J
Jane 12/1/2009

Hi,
you can calculate correct date and save it in the expiredate field in the Before record added/Before record updated events on the Events tab.

Here is a sample:

$values["expiredate"] = date("Y-m-d",strtotime($values["createdate"])+(60*60*24*30*6));
T
tedwilder author 12/1/2009

thanks a lot !