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


C# DateTime.ToLongTimeString方法代码示例

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


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

示例1: checkDateTime

        private static Boolean checkDateTime(DateTime time)
        {
            Boolean result = false;
            String path = ApplicationData.Current.LocalFolder.Path + "/time.txt";
            if (File.Exists(path)) {

                TextReader reader = new StreamReader(path);
                String date = reader.ReadLine();
                reader.Close();
                DateTime timeFile = DateTime.Parse(date);
                int compared = timeFile.CompareTo(time);
                if (compared > 0)
                {
                    TextWriter tw = new StreamWriter(path);
                    tw.WriteLine(time.ToLongDateString() + " " + time.ToLongTimeString());
                    tw.Close();
                    result = true;
                }
            } else {
                TextWriter tw = new StreamWriter(path);
                tw.WriteLine(time.ToLongDateString() + " " + time.ToLongTimeString());
                tw.Close();
            }
            return result;
        }
开发者ID:jules2689,项目名称:OCTranspoWP8,代码行数:25,代码来源:OCZipFile.cs

示例2: Button2_Click

 protected void Button2_Click(object sender, EventArgs e)
 {
     clockOutDateTime = DateTime.Now;
     Label2.Text = "Time ended: " + clockOutDateTime.ToLongTimeString();
     SubmitButton.Visible = true;
     ClockOutButton.Visible = false;
 }
开发者ID:j-whiteside,项目名称:clockpuncher,代码行数:7,代码来源:Tracker.aspx.cs

示例3: Button1_Click

 protected void Button1_Click(object sender, EventArgs e)
 {
     clockInDateTime = DateTime.Now;
     Label1.Text = "Time started: " + clockInDateTime.ToLongTimeString();
     ClockOutButton.Visible = true;
     ClockInButton.Visible = false;
 }
开发者ID:j-whiteside,项目名称:clockpuncher,代码行数:7,代码来源:Tracker.aspx.cs

示例4: DisplayText

        public void DisplayText(NetworkEvent ne)
        {
            this.m_Image = null;
            DateTime time = new DateTime(ne.timeIndex);
            this.infoLabel.Text = "";
            this.appendText("Sender: " + ne.source);
            this.appendText("Time: " + time.ToLongDateString() + " " + time.ToLongTimeString());
            if (ne is NetworkChunkEvent) {
                NetworkChunkEvent nce = ne as NetworkChunkEvent;
                this.appendText("Category: Chunk");
                this.appendText("Message Sequence: " + nce.chunk.MessageSequence);
                this.appendText("Chunk Sequence: " + nce.chunk.ChunkSequence);
                this.appendText("First Chunk Sequence of Message: " + nce.chunk.FirstChunkSequenceOfMessage);
                this.appendText("Number of Chunks: " + nce.chunk.NumberOfChunksInMessage);
            } else if (ne is NetworkMessageEvent) {
                NetworkMessageEvent nme = ne as NetworkMessageEvent;
                this.appendText("Category: Message");
                this.displayMessageEventRecursive(nme.message);
            } else if (ne is NetworkNACKMessageEvent) {

            } else {
                //Unknown
                this.infoLabel.Text = "Unknown Type";
            }
            this.doubleBufferPanel.Invalidate();
        }
开发者ID:ClassroomPresenter,项目名称:CP3,代码行数:26,代码来源:NetworkEventInfoForm.cs

示例5: BtStopwatchOptionsClick

 private void BtStopwatchOptionsClick(object sender, EventArgs e)
 {
     switch (btStopwatchOptions.Text)
     {
         case "Скинути":
             tabCircle.Controls.Clear();
             btControlStopwatch.Text = "Старт";
             btStopwatchOptions.Visible = false;
             btStopwatchOptions.Text = "Новий круг";
             dtStopwatch = new DateTime(2010, 2, 10, 0, 0, 0, 0);
             lbStopwatchResult.Text = String.Format("{0}:{1}", dtStopwatch.ToLongTimeString(), dtStopwatch.Millisecond / 100);
             for (int i = 0; i < tabPageList.dtList.Count; i++)
             {
                 tabPageList.dtList[i] = new DateTime(2010, 2, 10, 0, 0, 0, 0);
             }
             break;
         case "Новий круг":
             tabCircle.Controls.Add(tabPageList[tabPageList.Index]);
             tabPageList[tabPageList.Index].UseVisualStyleBackColor = true;
             tabCircle.SelectTab(tabPageList.Index) ;
             tabPageList.Index++;
             if (tabPageList.Index ==9)
             {
                 btStopwatchOptions.Enabled = false;
             }
             break;
         default:
             MessageBox.Show("Error");
             break;
     }
 }
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:31,代码来源:Stopwatch.cs

示例6: TmStopwatchTick

 void TmStopwatchTick(object sender, EventArgs e)
 {
     dtStopwatch = dtStopwatch.AddMilliseconds(100);
     tabPageList.dtList[tabPageList.Index - 1] = tabPageList.dtList[tabPageList.Index - 1].AddMilliseconds(100);
     lbStopwatchResult.Text = String.Format("{0}:{1}", dtStopwatch.ToLongTimeString(), dtStopwatch.Millisecond / 100);
     tabPageList.tabpLabel[tabPageList.Index - 1].Text = String.Format("{0}:{1}", tabPageList.dtList[tabPageList.Index - 1].ToLongTimeString(), tabPageList.dtList[tabPageList.Index - 1].Millisecond / 100);
 }
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:7,代码来源:Stopwatch.cs

示例7: setOutlookFields

        public void setOutlookFields(DateTime startDate, DateTime endDate, string room, DateTime startTime, DateTime endTime)
        {
            //Set To: field
            DateTime dateTimeStart;
            //String a = " 04:00 A.M";

            String test = startDate.ToLongDateString();
            String test2 = startDate.ToShortTimeString();
            String test4 = startDate.ToLongTimeString();
            String test3 = startDate.ToShortTimeString();

            dateTimeStart = DateTime.Parse(startDate.Month.ToString() + "/" + startDate.Day.ToString() + "/" + startDate.Year.ToString()  +" "+ startTime.Hour +":" + startTime.Minute +":" + startTime.Second+"." + startTime.Millisecond);

            DateTime dateTimeEnd;
            dateTimeEnd = DateTime.Parse(endDate.Month.ToString() + "/" + endDate.Day.ToString() + "/" + endDate.Year.ToString() + " " + endTime.Hour + ":" + endTime.Minute + ":" + endTime.Second + "." + endTime.Millisecond);

            //if (dateTimeStart > dateTimeEnd)
            //{

            //}
            //else
            //{
                (Globals.ThisAddIn.Application.ActiveInspector().CurrentItem as Outlook.AppointmentItem).StartInStartTimeZone = dateTimeStart;
                (Globals.ThisAddIn.Application.ActiveInspector().CurrentItem as Outlook.AppointmentItem).EndInEndTimeZone = dateTimeEnd;
                (Globals.ThisAddIn.Application.ActiveInspector().CurrentItem as Outlook.AppointmentItem).Location = room;
            //}
        }
开发者ID:chiakh,项目名称:SmartRoomBookingSystem,代码行数:27,代码来源:ThisAddIn.cs

示例8: CheckPause

 private void CheckPause(string data)
 {
     if (data.Contains("recaptcha_response_field"))
     {
         StatusUpdate(this, new StatusChanged { ChangedData = ChangedType.Stop, Param = 1 });
         return;
     }
     if (data.Contains("class=\"i3\"") || data.Contains("class=\"i4\""))
     {
         StatusUpdate(this, new StatusChanged() { ChangedData = ChangedType.Stop, Param = 0 });
         return; // no igm found, go on processing.
     }
     if(NextRead > DateTime.Now)
         return; // too short interval, go on pausing.
     data = this.pageQuerier.PageQuery(0, "nachrichten.php", null, true, true);
     if(data == null)
         return; // cannot read... network problem?
     int next = rand.Next(15,30);
     NextRead = DateTime.Now.AddMinutes(next);
     if(Regex.Match(data, "<a href=\"nachrichten.php[^\"]+\">" + RemoteStopWord + "</a>", RegexOptions.IgnoreCase).Success)
     {
         NextExec = DateTime.Now.AddMinutes(next + rand.Next(1,5));
         DebugLog("Pause: To " + NextExec.ToLongTimeString(), DebugLevel.W);
         StatusUpdate(this, new StatusChanged() { ChangedData = ChangedType.Stop, Param = 1 });
     }
     else
         StatusUpdate(this, new StatusChanged() { ChangedData = ChangedType.Stop, Param = 0 });
 }
开发者ID:GaryHuang-CL,项目名称:stran,代码行数:28,代码来源:RemoteCtrl.cs

示例9: EncryptTime

        public string EncryptTime(DateTime time)
        {
            string timeString = time.ToLongTimeString();
             string encryptString =  Crypto.Encrypt(timeString);

             return encryptString;
        }
开发者ID:udelblue,项目名称:LiveLinks,代码行数:7,代码来源:TokenGenerator.cs

示例10: Form1_Load

 private void Form1_Load(object sender, EventArgs e)
 {
     LeXML L = new LeXML(File);
     label1.Text = O.Retorna_Pos_Ult_Prodt().ToString();
     Tempo_Atual = DateTime.Now;
     DataHora.Text = Tempo_Atual.ToLongDateString()+"  -  " + Tempo_Atual.ToLongTimeString();
 }
开发者ID:minafrajr,项目名称:BDAutoPecas2,代码行数:7,代码来源:Form1.cs

示例11: DrawDigitalClock

        /// <summary>
        /// Цифровые часы
        /// </summary>
        /// <param name="graphics"></param>
        public void DrawDigitalClock(Graphics graphics, Point point)
        {
            _time = DateTime.Now;

            graphics.DrawString(_time.ToLongTimeString(), new Font("Arial", 30),
                new SolidBrush(Color.Red), point);
        }
开发者ID:npzxcf,项目名称:ComputerGraphics,代码行数:11,代码来源:Clock.cs

示例12: timer_Tick

        private void timer_Tick(object sender, EventArgs e)
        {
            _dtNow = DateTime.Now;
            DatetimeNow = _dtNow.ToLongTimeString();
            _sec = _dtNow.Second;
            _min = _dtNow.Minute;
            _hor = _dtNow.Hour;

            _angle = Math.PI / 30 * _sec - Math.PI / 2;

            if (_lnHor != null && _lnMin != null && _lnHor != null)
            {
                _lnSec.X2 = 50 + Math.Cos(_angle) * _secLen;
                _lnSec.Y2 = 50 + Math.Sin(_angle) * _secLen;

                _angle = Math.PI / 1800 * (_min * 60 + _sec) - Math.PI / 2;

                _lnMin.X2 = 50 + Math.Cos(_angle) * _minLen;
                _lnMin.Y2 = 50 + Math.Sin(_angle) * _minLen;

                _angle = Math.PI / 21600 * (_hor * 3600 + _min * 60 + _sec) - Math.PI / 2;

                _lnHor.X2 = 50 + Math.Cos(_angle) * _horLen;
                _lnHor.Y2 = 50 + Math.Sin(_angle) * _horLen;
            }
        }
开发者ID:RandyCode,项目名称:SimpleTools,代码行数:26,代码来源:Clock.cs

示例13: NRVFile

        public NRVFile(string ERName, string Door, string CardType, DateTime StartTime, string NVRFile, string VideoRecord)
        {
            InitializeComponent();

            txt_ERName.Text = ERName;
            txt_Door.Text = Door;
            txt_StartTime.Text = StartTime.ToLongDateString() + " " + StartTime.ToLongTimeString();
            txt_EventName.Text = CardType;
            nvrFile = NVRFile;

            string showNVRFile= "/VideoRecord/" + nvrFile.Trim();
            //media.Source = new Uri("http://192.192.85.64/secure/ClientBin" + showNVRFile,UriKind.Absolute);
            media.Source = new Uri(VideoRecord + showNVRFile, UriKind.Absolute);
           

            double totalSeconds = media.Position.TotalSeconds;      // 获取当前位置秒数
            double nowTotalSeconds = media.NaturalDuration.TimeSpan.TotalSeconds;  //获取文件总播放秒数

            nowTime.Text = totalSeconds.ToString();
            totalTime.Text = (Math.Round(nowTotalSeconds, 0)).ToString();

            //WebClient wc = new WebClient();
            //wc.OpenReadCompleted +=(s,a)=>
            //    {
            //        media.SetSource(a.Result as Stream);
            //    };
            //wc.OpenReadAsync(new Uri("http://192.192.85.64/secure/ClientBin" + showNVRFile,UriKind.Absolute));
        }
开发者ID:ufjl0683,项目名称:slSecureAndPD,代码行数:28,代码来源:NRVFile.xaml.cs

示例14: WriteText

		public void WriteText(System.IO.TextWriter writer, LogLevels level, DateTime dateTime, string text)
		{
			string sLevel;
			switch (level)
			{
				case LogLevels.Info:
				default:
					sLevel = "I";
					break;

				case LogLevels.Diagnostic:
					sLevel = "D";
					break;

				case LogLevels.Warning:
					sLevel = "W";
					break;

				case LogLevels.Error:
					sLevel = "E";
					break;
			}

			writer.WriteLine("{0}:{1} {2} [{4}]: {3}",
				sLevel, dateTime.ToShortDateString(), dateTime.ToLongTimeString(),
				text, Thread.CurrentThread.GetHashCode());
		}
开发者ID:eleven41,项目名称:Eleven41.Logging,代码行数:27,代码来源:DefaultTextWriterFormatter.cs

示例15: InsertSensorData

 public int InsertSensorData(
     int sensorMetadataId, 
     int intermediateHwMetadataId, 
     string measuredData, 
     DateTime measuredAt, 
     DateTime polledAt, 
     int sensorType)
 {
     // using (SqlConnection connection = new SqlConnection(connectionStringb.ConnectionString))
     using (SqlConnection connection = new SqlConnection(this.connectionString))
     {
         string queryString =
             string.Format(
                 "INSERT INTO SensorData (SensorMetadataId, IntermediateHwMedadataId, MeasuredData, MeasuredAt, SendAt, PolledAt, UpdatedAt, CreatedAt,  SensorType) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}');",
                 sensorMetadataId,
                 intermediateHwMetadataId,
                 measuredData,
                 measuredAt.ToLongDateString() + " " + measuredAt.ToLongTimeString(),
                 measuredAt.ToLongDateString() + " " + measuredAt.ToLongTimeString(),
                 polledAt.ToLongDateString() + " " + polledAt.ToLongTimeString(),
                 measuredAt.ToLongDateString() + " " + measuredAt.ToLongTimeString(),
                 measuredAt.ToLongDateString() + " " + measuredAt.ToLongTimeString(),
                 sensorType);
         SqlCommand command = new SqlCommand(queryString, connection);
         return ExecuteSQLCommand(command);
     }
 }
开发者ID:OccupOS,项目名称:OccupOSCloud,代码行数:27,代码来源:SQLServerHelper.cs


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