如果输入日期,如何使用REGEX模式返回星期几? [英] How to use REGEX patterns to return day of the week if a date is entered?
问题描述
我正在尝试根据在主数据服务中另一个单元(但BUT)中输入的日期,在一个单元格中填充星期几.我知道我将需要在业务规则中执行此操作并将其应用于属性.我想知道是否可以使用REGEX模式或其他任何聪明的方法.因此,例如,如果我有一列包含2016年12月21日的信息,我希望下一列为星期三".谢谢!
I am trying to create something that will populate the day of the week in one cell based on a date entered in another, BUT in Master Data Services. I know I will need to do this in a business rule and apply it to the attributes. I am wondering if this can be don using REGEX patterns or any other clever method. So, for example if I have a column with 12/21/2016 in it, I want the next column to say "Wednesday". Thanks!
推荐答案
最简单的方法是使用sql并使用计算列或直接在视图中使用.我对MDS不太熟悉,因此可能会有更好的解决方案(甚至不可能).
The simplest way would be using sql and use a calculated column or directly in a view. I'm not that familiar with MDS so there might be a better solution (or not even possible).
alter table mytable add weekday as DATENAME(dw,fieldname) persisted
请勿尝试执行自己的日期/时间函数,您将失败
Do never try to do your own date/time functions, you will fail
这篇关于如果输入日期,如何使用REGEX模式返回星期几?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!