本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
}
示例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);
}
示例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;
//}
}
示例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 });
}
示例9: EncryptTime
public string EncryptTime(DateTime time)
{
string timeString = time.ToLongTimeString();
string encryptString = Crypto.Encrypt(timeString);
return encryptString;
}
示例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();
}
示例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);
}
示例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;
}
}
示例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));
}
示例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());
}
示例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);
}
}