zoukankan      html  css  js  c++  java
  • 日本财政年度取得(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;
            }

  • 相关阅读:
    IO(文件)处理
    集合 (set) 的增删改查及 copy()方法
    字典 (dict) 的增删改查及其他方法
    列表(List) 的增删改查及其他方法
    细数Python中的数据类型以及他们的方法
    CCNA基础 IP地址子网划分
    [转] SSH原理与运用(2):远程操作与端口转发
    记俩次连续失误操作造成的数据丢失损坏解决
    CentOS 下 MySQL DateBasic 抢救
    China Mobile 免流原理
  • 原文地址:https://www.cnblogs.com/secying/p/2172300.html
Copyright © 2011-2022 走看看