确定 Oracle 日期是否在周末?
这是确定 Oracle 日期是否在周末的最佳方法吗?
Is this the best way to determine if an Oracle date is on a weekend?
select * from mytable
where
TO_CHAR (my_date, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') IN ('SAT', 'SUN');
推荐答案
从 Oracle 11g 开始,是的.我见过的唯一可行的区域不可知替代方案如下:
As of Oracle 11g, yes. The only viable region agnostic alternative that I've seen is as follows:
SELECT *
FROM mytable
WHERE MOD(TO_CHAR(my_date, 'J'), 7) + 1 IN (6, 7);
相关文章