本文介绍了夏令时活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


夏时制发生时,我需要做一些事情.我知道有一些
发生TimeChange事件,但是当用户手动更改时间并且我无法区分这两种情况时,也会发生此事件.
我需要一个可以肯定地告诉我的事件:现在发生了夏时制,而不是手动更改时间".

请指教,
谢谢.

Hi,
I need to do something when daylight saving occurs. I know that there is some
TimeChange event that happens but this event is also happens when user change the time manualy and i cant distinguish between those 2 situation.
I need an event that will tell me for sure: "DayLight saving happened now and not manual time change".

Please advice,
Thanks.

推荐答案


public bool IsDay(DateTime value)
        {
            if (value.Hour > 7 && value.Hour < 19)
                return true;
            else
                return false;
        }
        public bool IsNight(DateTime value)
        {
            bool isDay = IsDay(value);
            return !isDay;
        }



最好的问候



Best Regards



这篇关于夏令时活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-08 13:23