当前位置: 首页>>代码示例>>C#>>正文


C# System.DateTime.AddMinutes方法代码示例

本文整理汇总了C#中System.DateTime.AddMinutes方法的典型用法代码示例。如果您正苦于以下问题:C# System.DateTime.AddMinutes方法的具体用法?C# System.DateTime.AddMinutes怎么用?C# System.DateTime.AddMinutes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.DateTime的用法示例。


在下文中一共展示了System.DateTime.AddMinutes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Form1

        public Form1()
        {
            InitializeComponent();
            _1min = Properties.Settings.Default._1min;
            _5min = Properties.Settings.Default._5min;
            menuStrip.BackColor = System.Drawing.ColorTranslator.FromHtml("#88ffffff");
            horario = System.DateTime.Today;
            horario = horario.AddHours(Properties.Settings.Default.Hora); //Utiliza a configuração padrão de hora
            horario = horario.AddMinutes(Properties.Settings.Default.Minuto); //Utiliza a configuração padrão de minuto
            alterarFontes();
            lblRelogio.Text = System.DateTime.Now.ToString("HH:mm");
            timer1.Interval = 1000;
            timer1.Start();
            //Inicializa a localização dos audios
            _1minPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\resources\\mp3_1min.mp3";
            _5minPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\resources\\mp3_5min.mp3";
            if (!System.IO.File.Exists(_1minPath) || !System.IO.File.Exists(_5minPath))
                System.Windows.MessageBox.Show("Arquivos de áudio foram deletados ou corrompidos\nReinstale o programa para corrigir.", "Falha ao abrir áudios", System.Windows.MessageBoxButton.OK, MessageBoxImage.Error);

            configurarExibicao();
        }
开发者ID:quenazsoares,项目名称:EscolaSabatinaRelogio,代码行数:21,代码来源:Form1.cs

示例2: ToDateTime

 // Converts a given datetime in DMTF format to System.DateTime object.
 static System.DateTime ToDateTime(string dmtfDate)
 {
     System.DateTime initializer = System.DateTime.MinValue;
     int year = initializer.Year;
     int month = initializer.Month;
     int day = initializer.Day;
     int hour = initializer.Hour;
     int minute = initializer.Minute;
     int second = initializer.Second;
     long ticks = 0;
     string dmtf = dmtfDate;
     System.DateTime datetime = System.DateTime.MinValue;
     string tempString = string.Empty;
     if ((dmtf == null))
     {
         throw new System.ArgumentOutOfRangeException();
     }
     if ((dmtf.Length == 0))
     {
         throw new System.ArgumentOutOfRangeException();
     }
     if ((dmtf.Length != 25))
     {
         throw new System.ArgumentOutOfRangeException();
     }
     try
     {
         tempString = dmtf.Substring(0, 4);
         if (("****" != tempString))
         {
             year = int.Parse(tempString);
         }
         tempString = dmtf.Substring(4, 2);
         if (("**" != tempString))
         {
             month = int.Parse(tempString);
         }
         tempString = dmtf.Substring(6, 2);
         if (("**" != tempString))
         {
             day = int.Parse(tempString);
         }
         tempString = dmtf.Substring(8, 2);
         if (("**" != tempString))
         {
             hour = int.Parse(tempString);
         }
         tempString = dmtf.Substring(10, 2);
         if (("**" != tempString))
         {
             minute = int.Parse(tempString);
         }
         tempString = dmtf.Substring(12, 2);
         if (("**" != tempString))
         {
             second = int.Parse(tempString);
         }
         tempString = dmtf.Substring(15, 6);
         if (("******" != tempString))
         {
             ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
         }
         if (((((((((year < 0)
                     || (month < 0))
                     || (day < 0))
                     || (hour < 0))
                     || (minute < 0))
                     || (minute < 0))
                     || (second < 0))
                     || (ticks < 0)))
         {
             throw new System.ArgumentOutOfRangeException();
         }
     }
     catch (System.Exception e)
     {
         throw new System.ArgumentOutOfRangeException(null, e.Message);
     }
     datetime = new System.DateTime(year, month, day, hour, minute, second, 0);
     datetime = datetime.AddTicks(ticks);
     System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(datetime);
     int UTCOffset = 0;
     int OffsetToBeAdjusted = 0;
     long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)));
     tempString = dmtf.Substring(22, 3);
     if ((tempString != "******"))
     {
         tempString = dmtf.Substring(21, 4);
         try
         {
             UTCOffset = int.Parse(tempString);
         }
         catch (System.Exception e)
         {
             throw new System.ArgumentOutOfRangeException(null, e.Message);
         }
         OffsetToBeAdjusted = ((int)((OffsetMins - UTCOffset)));
         datetime = datetime.AddMinutes(((double)(OffsetToBeAdjusted)));
     }
//.........这里部分代码省略.........
开发者ID:b1thunt3r,项目名称:WinInfo,代码行数:101,代码来源:ComputerSystem.cs

示例3: checkCachedMetadataValidity

        /**
         * @return un oggetto di tipo bool
         * Il metodo in questione verifica la validità del file contenente i metadatai
         * salvato sul File System.
         *
         */
        private bool checkCachedMetadataValidity()
        {
            const string pos = "Cachemanager.checkCachedMetadataValidity - ";
            log.Info(pos + "INIT");

            bool validity = true;
            lastWriteTime = File.GetLastWriteTime(Constants.getMetadatasetFullName());

            log.Info(pos + "lastWriteTime:" + lastWriteTime);

            System.DateTime dateValidity = lastWriteTime.AddMinutes(Constants.KP_METADATASET_TIMEOUT);
            System.DateTime currDate = System.DateTime.Now;

            log.Info(pos + "Validity time:" + dateValidity);
            log.Info(pos + "Current time:" + currDate);

            if (dateValidity.CompareTo(currDate) < 0)
            {
                validity = false;
            }

            log.Info(pos + "Validity :" + validity);

            return validity;
        }
开发者ID:webscience,项目名称:K-people,代码行数:31,代码来源:Cachemanager.cs


注:本文中的System.DateTime.AddMinutes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。