欢迎来到忆约科技! 手机版
编程专栏
网络探索
科技频道
社会话题
美文鉴赏

签到时间计算

编辑时间:2018年02月03日 16:59 作者:E小编

            //// 按月签到
            //string signtime = "12:00";
            //string signdate = "23";
            //DateTime start = Convert.ToDateTime(DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + signdate + " " + signtime).AddHours(-1);
            //DateTime end = Convert.ToDateTime(DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + signdate + " " + signtime).AddHours(+4);

            //// 按周签到
            //string signtime = "12:00";
            //string signweek = "5";// 每周星期几
            //if ((int)DateTime.Now.DayOfWeek==(int.Parse(signweek)))
            //{
            //    DateTime start = Convert.ToDateTime(DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + " " + signtime).AddHours(-1);
            //    DateTime end = Convert.ToDateTime(DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + " " + signtime).AddHours(+4);
            //}

            // 按天签到
            string signtime = "12:00";
            DateTime start = Convert.ToDateTime(DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + " " + signtime).AddHours(-1);
            DateTime end = Convert.ToDateTime(DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + " " + signtime).AddHours(+4);

二维码