简体   繁体   English

返回当前月份和年份以及1个月的SSRS /表达式

[英]Return current month and year plus 1 month SSRS/Expression

so this returns the next month: 所以这将返回下个月:

=MonthName(Month(DateAdd("m", +1, CDate(Today))))

So if its November, this returns December. 因此,如果是11月,则返回12月。 That is great. 太棒了。 However, I need to return month - year one month ahead. 但是,我需要返回一个月-提前一年一个月。

So if its November i want it to return December 2013. If its December 2013 I want it to return January 2014. Help? 因此,如果我希望它在11月返回2013年12月。如果我希望在2013年12月返回2014年1月。

=Format(DateAdd("m", 1, CDate(Today)),"mmm - yyyy")

Read the documentation I've linked in order to learn more about the 'Format' function. 阅读我链接的文档,以了解有关“格式”功能的更多信息。 Basically, this function takes in: 基本上,该函数具有:

  1. An Expression, in this case a date 表达式,在这种情况下为日期
  2. A String, in this case "mmm - yyyy" 一个字符串,在这种情况下为“ mmm-yyyy”

It then follows a set of rules, parsing the data into the given format. 然后,它遵循一组规则,将数据解析为给定的格式。 There are a handful of other formats that you can specify. 您可以指定其他几种格式。 These are explained in the documentation. 这些在文档中进行了解释。

SOURCE: VBA Experience, documentation 消息来源:VBA经验, 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM