001 /** 002 * Implements the CFML Function minute 003 */ 004 package railo.runtime.functions.dateTime; 005 006 import java.util.TimeZone; 007 008 import railo.commons.date.DateTimeUtil; 009 import railo.commons.date.TimeZoneUtil; 010 import railo.runtime.PageContext; 011 import railo.runtime.exp.ExpressionException; 012 import railo.runtime.exp.PageException; 013 import railo.runtime.functions.BIF; 014 import railo.runtime.op.Caster; 015 import railo.runtime.type.dt.DateTime; 016 017 public final class Minute extends BIF { 018 019 private static final long serialVersionUID = 1716321988319981966L; 020 021 public static double call(PageContext pc , DateTime date) { 022 return _call(pc, date, pc.getTimeZone()); 023 } 024 025 public static double call(PageContext pc , DateTime date, String strTimezone) throws ExpressionException { 026 return _call(pc, date, strTimezone==null?pc.getTimeZone():TimeZoneUtil.toTimeZone(strTimezone)); 027 } 028 029 private static double _call(PageContext pc , DateTime date,TimeZone tz) { 030 return DateTimeUtil.getInstance().getMinute(tz, date); 031 } 032 033 @Override 034 public Object invoke(PageContext pc, Object[] args) throws PageException { 035 if(args.length==1)return call(pc,Caster.toDatetime(args[0],pc.getTimeZone())); 036 return call(pc,Caster.toDatetime(args[0],pc.getTimeZone()),Caster.toString(args[1])); 037 } 038 }