This topic is locked

Date Box

3/12/2007 7:36:11 AM
PHPRunner General questions
M
matteor author

Hello, i've a problem;
i've a date box on a date field (date_start), i set it with the function now();
but i've another date box on a date field (date_end), and i would to like to have him set as date_start+4 months.
How can i do it?
Please help me!!!!

J
Jane 3/12/2007

Hi,
you can calculate end date in the ListOnLoad event on the Events tab, save it in the $_SESSION variable and then use $_SESSION["new_date"] as default value on the "Edit as" settings dialog on the Visual Editor tab.

Here is a sample code of the ListOnLoad event:

function ListOnLoad()

{

global $strSQL;

$today = getdate();

$mons=$today["mon"]+4;

$newdata=$today["year"]."-".$mons."-".$today["mday"];

$_SESSION["new_date"] = $newdata;

}

M
matteor author 3/12/2007

Hi,

you can calculate end date in the ListOnLoad event on the Events tab, save it in the $_SESSION variable and then use $_SESSION["new_date"] as default value on the "Edit as" settings dialog on the Visual Editor tab.

Here is a sample code of the ListOnLoad event:


perfect!!!
thanks for your help from italy!!!