<?php

function fn_interval_c($aql)
{
	$data = $aql->Consume(1);	
	$framea = $data[0]->value;
	
	if (is_array($framea)) $framea = $framea[0];
	
	$bits = explode(' from ',$v);
	$dateend = date("Y-m-d H:i:s");		
	$range = DateInterval::createFromDateString($framea);			
	$datestart = DateTime::createFromFormat("Y-m-d H:i:s",$dateend,new DateTimeZone('UTC'));
	$datestart = $datestart->sub($range);
	$datestart = $datestart->format("Y-m-d H:i:s");
	
	$nfinal = array();
	$itm = array();
	$itm['from'] = $datestart;
	$itm['to'] = $dateend;
	$nfinal[] = $itm;
	
	$a = new AQLStackElement();
	$a->typename = "timelist";
	$a->islist = true;
	$a->value = $nfinal;
	array_push($aql->stack,$a);
}
?>