001 /** 002 * Implements the Cold Fusion Function dayofweek 003 */ 004 package railo.runtime.functions.international; 005 006 import java.util.Locale; 007 import java.util.TimeZone; 008 009 import railo.commons.date.DateTimeUtil; 010 import railo.commons.date.TimeZoneUtil; 011 import railo.runtime.PageContext; 012 import railo.runtime.exp.ExpressionException; 013 import railo.runtime.ext.function.Function; 014 import railo.runtime.i18n.LocaleFactory; 015 import railo.runtime.type.dt.DateTime; 016 017 public final class LSDayOfWeek implements Function { 018 019 private static final long serialVersionUID = -9002250869621547151L; 020 021 public static double call(PageContext pc , DateTime date) { 022 return _call(pc, date, pc.getLocale(),pc.getTimeZone()); 023 } 024 025 public static double call(PageContext pc , DateTime date, String strLocale) throws ExpressionException { 026 return _call(pc, date, LocaleFactory.getLocale(strLocale),pc.getTimeZone()); 027 } 028 029 public static double call(PageContext pc , DateTime date, String strLocale, String strTimezone) throws ExpressionException { 030 return _call(pc, date, 031 strLocale==null?pc.getLocale():LocaleFactory.getLocale(strLocale), 032 strTimezone==null?pc.getTimeZone():TimeZoneUtil.toTimeZone(strTimezone)); 033 } 034 035 private static double _call(PageContext pc , DateTime date,Locale locale,TimeZone tz) { 036 return DateTimeUtil.getInstance().getDayOfWeek(locale,tz, date); 037 } 038 }