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