001 /** 002 * Implements the Cold Fusion Function hour 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 Hour implements Function { 016 public static double call(PageContext pc , DateTime date) { 017 return _call(pc, date, pc.getTimeZone()); 018 } 019 020 public static double call(PageContext pc , DateTime date, String strTimezone) throws ExpressionException { 021 return _call(pc, date, strTimezone==null?pc.getTimeZone():TimeZoneUtil.toTimeZone(strTimezone)); 022 } 023 024 private static double _call(PageContext pc , DateTime date,TimeZone tz) { 025 return DateTimeUtil.getInstance().getHour(tz, date); 026 } 027 028 }