001 package railo.runtime.functions.dateTime; 002 003 import railo.runtime.PageContext; 004 import railo.runtime.exp.ExpressionException; 005 import railo.runtime.exp.PageException; 006 import railo.runtime.functions.BIF; 007 import railo.runtime.op.Caster; 008 import railo.runtime.type.dt.DateTime; 009 010 public class DateDiffMember extends BIF { 011 public synchronized static double call(PageContext pc, DateTime left, DateTime right) throws ExpressionException { 012 return DateDiff.call(pc, "s", left, right); 013 } 014 public synchronized static double call(PageContext pc, DateTime left, DateTime right,String datePart) throws ExpressionException { 015 return DateDiff.call(pc, datePart, left, right); 016 } 017 018 @Override 019 public Object invoke(PageContext pc, Object[] args) throws PageException { 020 if(args.length==2)return call(pc,Caster.toDatetime(args[0],pc.getTimeZone()),Caster.toDatetime(args[1],pc.getTimeZone())); 021 return call(pc,Caster.toDatetime(args[0],pc.getTimeZone()),Caster.toDatetime(args[1],pc.getTimeZone()),Caster.toString(args[2])); 022 } 023 }