Determine if the point in time is within the working day interval

Source: Internet
Author: User

Tag: Date string his reg std Mon tostring color BSP

      #region          //gets the current number of weeks        Private ReadOnly string_strworkingdayam ="08:30";//working hours a.m.        Private ReadOnly string_STRWORKINGDAYPM ="17:30"; Private ReadOnly string_strrestday ="6,7";//days of rest Saturday Sunday for 6,7        PrivateTimeSpan _dspworkingdayam;//working hours a.m.        PrivateTimeSpan _dspworkingdaypm; Private stringM_getweeknow () {stringStrweek =DateTime.Now.DayOfWeek.ToString (); Switch(strweek) { Case "Monday":                    return "1";  Case "Tuesday":                    return "2";  Case "Wednesday":                    return "3";  Case "Thursday":                    return "4";  Case "Friday":                    return "5";  Case "Saturday":                    return "6";  Case "Sunday":                    return "7"; }            return "0"; }         /// <summary>        ///determine if it is within the working day/// </summary>        /// <returns></returns>        Private BOOLM_isworkingday () {stringStrweeknow = This. M_getweeknow ();//Current Week                                                    ////Determine if there is a day off            string[] Restday = _strrestday.split (','); if(Restday.contains (Strweeknow)) {return false; }            //determine if the current time is within the working time period_dspworkingdayam=DateTime.Parse (_strworkingdayam).            TimeOfDay; _DSPWORKINGDAYPM=DateTime.Parse (_STRWORKINGDAYPM).            TimeOfDay; TimeSpan Dspnow=DateTime.Now.TimeOfDay; if(Dspnow > _dspworkingdayam && dspnow <_dspworkingdaypm) {                return true; }            return false; }         #endregion 

Determine if the point in time is within the working day interval

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.