【问题标题】:I need to change my calendar format to start and end on the 23rd of each month (financial month)我需要将日历格式更改为每月 23 日(财政月)开始和结束
【发布时间】:2017-08-30 15:18:33
【问题描述】:

我正在做一个项目,我需要将月份格式更改为从 23 日开始,然后在 23 日再次结束。

你有解决办法吗?

【问题讨论】:

  • 更精确。您使用的是什么日历控件?
  • 它用于图表。所以我需要每个月设置一个带有特定日期的变量,但我需要用纯 C# 来做。不是真的 Javascript(只有当我真的需要时)。该图应该是从 23 日到 23 日。

标签: javascript c# date


【解决方案1】:

有点不清楚你真正要问的是什么。在 C# 中,日期可以用 DateTime 结构表示。例如:

int startYear = 2017;
int startMonth = 2;
int startDay = 23;
DateTime startDate = new DateTime(startYear, startMonth, startDay);
//
int endYear = 2017;
int endMonth = 3;
int endDay = 23;
DateTime endDate = new DateTime(endYear, endMonth, endDay);

如果这没有帮助,请尝试查看Working with Calendars。

如果没有答案可以帮助您,那么您需要提供更多信息。例如,尝试发布您正在使用的代码。您不需要发布整个项目,只需发布​​您遇到问题的 sn-p 或类。

【讨论】:

    【解决方案2】:

    使用 AJAX 日历扩展器。这是示例标记代码:

     <asp:CalendarExtender ID="ControlIDHere" runat="server" Enabled="True"
                            TargetControlID="TextBoxIDHere" PopupButtonID="CalenderImageIDHere" Format="MM/dd/yyyy">
     </asp:CalendarExtender>
    

    您还可以在 CalendarExtender 中初始化 StartDate 和 EndDate。

    希望有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-10
      • 2023-03-10
      • 2014-04-26
      • 2019-07-07
      相关资源
      最近更新 更多