• 日本财政年度取得(c#,vb.net)


    vb.net:

      '----------------------------------------------------------------
        '-  @(f)
        '-
        '-  機    能: 日本財政年度取得
        '-
        '-  返    値:    日本財政年度
        '-
        '-  引    数: 日付
        '-
        '-  機能説明: 日本財政年度取得
        '-
        '----------------------------------------------------------------
        Public Function GetJpNendo(ByVal dtValue As Date) As String
            Dim strNendo As String

            Try
                strNendo = dtValue.ToString().Substring(0, 4)
                Dim dtTemp As Date = CDate(strNendo & "/03/31")
                If Date.Compare(dtValue, dtTemp) < 0 OrElse Date.Compare(dtValue, dtTemp) = 0 Then
                    strNendo = CStr(CInt(strNendo) - 1)
                End If
            Catch ex As Exception
            End Try
            Return strNendo
        End Function

    c#:

        /// <summary>
            /// 日本財政年度取得
            /// </summary>
            /// <param name="dtValue">日付</param>
            /// <returns>日本財政年度</returns>
            private string GetJPNendo(DateTime dtValue)
            {
                string strNendo = string.Empty;
                try
                {
                    strNendo = dtValue.ToString().Substring(0, 4);
                    DateTime dtTemp = DateTime.Parse(strNendo + "/03/31");
                    if (dtValue <= dtTemp)
                    {
                        strNendo = Convert.ToString(Convert.ToInt32(strNendo) - 1);
                    }
                }
                catch
                {
                }
                return strNendo;
            }

  • 相关阅读:
    12.浏览器测试
    11.测试用例管理
    10.测试用例的钩子
    如何处理JSON中的特殊字符
    foreach的参数不是数组:Warning: Invalid argument supplied for foreach
    CI中的控制器中要用model中的方法,是统一写在构造器方法中,还是在每一个方法中分别写
    CodeIgniter配置之config
    **Apache Options指令详解
    .htaccess的基本作用及相关语法介绍
    .htaccess文件的作用(访问控制)
  • 原文地址:https://www.cnblogs.com/secying/p/2172300.html
Copyright © 2020-2023  润新知