Format datetime day with st, nd, rd, th

前端 未结 3 547
谎友^
谎友^ 2021-01-24 02:10

I\'m creating a report in SSRS and across the top I have a header with a placeholder for \"Last Refreshed\" which will show when the report last ran.

My function in the

3条回答
  •  太阳男子
    2021-01-24 02:59

    I found an easy way to do it. Please see example below;

    = DAY(Globals!ExecutionTime) & 
        SWITCH(
        DAY(Globals!ExecutionTime)= 1 OR DAY(Globals!ExecutionTime) = 21 OR DAY(Globals!ExecutionTime)=31, "st",
        DAY(Globals!ExecutionTime)= 2 OR DAY(Globals!ExecutionTime) = 22 , "nd",
        DAY(Globals!ExecutionTime)= 3 OR DAY(Globals!ExecutionTime) = 23 , "rd",
        true, "th"
        )
    

提交回复
热议问题