系统时间的获取和操作

很多时候会保存有效期限,这里是简单的一个应用

1.有效期限到:一周

2.有效期限到:半个月

3.有效期限到:一个月

4.有效期限到:三个月

 /// <summary>
        /// 通过选择radiobutton得到有效期;
        /// </summary>
        /// <returns></returns>
        public string GetEffTime()
        {
           string p_effTime="";
            int span= int.Parse(RRL_effTime.SelectedValue.ToString());

            switch (span)
            {
               
                case 1:
                    p_effTime = System.DateTime.Now.AddDays(7).ToString();
                    break;
                case 2:
                    p_effTime = System.DateTime.Now.AddDays(14).ToString();
                    break;
                case 4:
                    p_effTime = System.DateTime.Now.AddMonths(1).ToString();
                    break;
                case  12:
                    p_effTime = System.DateTime.Now.AddMonths(3).ToString();
                    break;
                default:
                    p_effTime = System.DateTime.Now.AddDays(7).ToString();
                    break;
            }
            return p_effTime;

        }

posted on 2008-10-28 21:48  SUNJUNLIN  阅读(345)  评论(0编辑  收藏  举报

导航