001 /** 002 * Implements the Cold Fusion Function createdate 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.ext.function.Function; 013 import railo.runtime.type.dt.DateTime; 014 015 public final class CreateDate implements Function { 016 public static DateTime call(PageContext pc , double year, double month, double day) throws ExpressionException { 017 return _call(pc,year,month,day,pc.getTimeZone()); 018 } 019 public static DateTime call(PageContext pc , double year, double month, double day,String strTimezone) throws ExpressionException { 020 return _call(pc,year,month,day,strTimezone==null?pc.getTimeZone():TimeZoneUtil.toTimeZone(strTimezone)); 021 } 022 private static DateTime _call(PageContext pc , double year, double month, double day,TimeZone tz) throws ExpressionException { 023 return DateTimeUtil.getInstance().toDateTime(tz,(int)year,(int)month,(int)day, 0, 0, 0,0); 024 } 025 }